Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / cc / test / solid_color_content_layer_client.cc
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/test/solid_color_content_layer_client.h"
6
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkPaint.h"
9 #include "ui/gfx/rect.h"
10 #include "ui/gfx/rect_f.h"
11
12 namespace cc {
13
14 void SolidColorContentLayerClient::PaintContents(
15     SkCanvas* canvas,
16     const gfx::Rect& rect,
17     gfx::RectF* opaque_rect,
18     ContentLayerClient::GraphicsContextStatus gc_status) {
19   SkPaint paint;
20   paint.setStyle(SkPaint::kFill_Style);
21   paint.setColor(color_);
22
23   canvas->clear(SK_ColorTRANSPARENT);
24   canvas->drawRect(
25       SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect.height()),
26       paint);
27
28   if (SkColorGetA(color_) == 255)
29     *opaque_rect = rect;
30 }
31
32 bool SolidColorContentLayerClient::FillsBoundsCompletely() const {
33   return false;
34 }
35
36 }  // namespace cc