Lots of random cleanups, mostly for native_theme_win.cc:
[chromium-blink-merge.git] / cc / test / fake_content_layer_client.cc
blob9f75d8920bb69d52c49eb5be432425a9fb2592ac
1 // Copyright 2012 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.
5 #include "cc/test/fake_content_layer_client.h"
7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h"
10 namespace cc {
12 FakeContentLayerClient::FakeContentLayerClient()
13 : paint_all_opaque_(false), last_canvas_(NULL) {}
15 FakeContentLayerClient::~FakeContentLayerClient() {
18 void FakeContentLayerClient::PaintContents(
19 SkCanvas* canvas,
20 const gfx::Rect& paint_rect,
21 gfx::RectF* opaque_rect,
22 ContentLayerClient::GraphicsContextStatus gc_status) {
23 last_canvas_ = canvas;
24 last_context_status_ = gc_status;
26 if (paint_all_opaque_)
27 *opaque_rect = paint_rect;
29 canvas->clipRect(gfx::RectToSkRect(paint_rect));
30 for (RectPaintVector::const_iterator it = draw_rects_.begin();
31 it != draw_rects_.end(); ++it) {
32 const gfx::RectF& draw_rect = it->first;
33 const SkPaint& paint = it->second;
34 canvas->drawRectCoords(draw_rect.x(),
35 draw_rect.y(),
36 draw_rect.right(),
37 draw_rect.bottom(),
38 paint);
41 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
42 it != draw_bitmaps_.end(); ++it) {
43 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint);
47 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
49 } // namespace cc