Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: cc/test/fake_content_layer_client.cc

Issue 519583003: Use the solid color detection to create solid layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused variable Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/fake_content_layer_client.h" 5 #include "cc/test/fake_content_layer_client.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h" 8 #include "ui/gfx/skia_util.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 FakeContentLayerClient::FakeContentLayerClient() 12 FakeContentLayerClient::FakeContentLayerClient()
13 : paint_all_opaque_(false), last_canvas_(NULL) {} 13 : paint_all_opaque_(false),
14 fill_with_nonsolid_color_(false),
15 last_canvas_(NULL) {
16 }
14 17
15 FakeContentLayerClient::~FakeContentLayerClient() { 18 FakeContentLayerClient::~FakeContentLayerClient() {
16 } 19 }
17 20
18 void FakeContentLayerClient::PaintContents( 21 void FakeContentLayerClient::PaintContents(
19 SkCanvas* canvas, 22 SkCanvas* canvas,
20 const gfx::Rect& paint_rect, 23 const gfx::Rect& paint_rect,
21 gfx::RectF* opaque_rect, 24 gfx::RectF* opaque_rect,
22 ContentLayerClient::GraphicsContextStatus gc_status) { 25 ContentLayerClient::GraphicsContextStatus gc_status) {
23 last_canvas_ = canvas; 26 last_canvas_ = canvas;
(...skipping 11 matching lines...) Expand all
35 draw_rect.y(), 38 draw_rect.y(),
36 draw_rect.right(), 39 draw_rect.right(),
37 draw_rect.bottom(), 40 draw_rect.bottom(),
38 paint); 41 paint);
39 } 42 }
40 43
41 for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); 44 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
42 it != draw_bitmaps_.end(); ++it) { 45 it != draw_bitmaps_.end(); ++it) {
43 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); 46 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint);
44 } 47 }
48
49 // Add a rectangle to the middle that doesn't fill |paint_rect| so that solid
50 // color analysis will fail.
51 if (fill_with_nonsolid_color_) {
52 gfx::RectF draw_rect = paint_rect;
53 draw_rect.Inset(draw_rect.width() / 4.0f, draw_rect.height() / 4.0f);
54 SkPaint paint;
55 canvas->drawRectCoords(draw_rect.x(),
56 draw_rect.y(),
57 draw_rect.right(),
58 draw_rect.bottom(),
59 paint);
60 }
45 } 61 }
46 62
47 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 63 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
48 64
49 } // namespace cc 65 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698