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

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

Issue 253013003: Enable disabling WebCore::GraphicsContext in telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 7 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 | Annotate | Revision Log
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), last_canvas_(NULL) {}
14 14
15 FakeContentLayerClient::~FakeContentLayerClient() { 15 FakeContentLayerClient::~FakeContentLayerClient() {
16 } 16 }
17 17
18 void FakeContentLayerClient::PaintContents(SkCanvas* canvas, 18 void FakeContentLayerClient::PaintContents(
19 const gfx::Rect& paint_rect, gfx::RectF* opaque_rect) { 19 SkCanvas* canvas,
20 const gfx::Rect& paint_rect,
21 gfx::RectF* opaque_rect,
22 ContentLayerClient::GraphicsContextStatus graphics_context_status) {
20 last_canvas_ = canvas; 23 last_canvas_ = canvas;
24 last_context_status_ = graphics_context_status;
21 if (!canvas) 25 if (!canvas)
danakj 2014/05/01 17:07:11 can get rid of this early out?
Stephen Chennney 2014/05/01 19:12:26 Yes, done.
22 return; 26 return;
23 27
24 if (paint_all_opaque_) 28 if (paint_all_opaque_)
25 *opaque_rect = paint_rect; 29 *opaque_rect = paint_rect;
26 30
27 canvas->clipRect(gfx::RectToSkRect(paint_rect)); 31 canvas->clipRect(gfx::RectToSkRect(paint_rect));
28 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 32 for (RectPaintVector::const_iterator it = draw_rects_.begin();
29 it != draw_rects_.end(); ++it) { 33 it != draw_rects_.end(); ++it) {
30 const gfx::RectF& draw_rect = it->first; 34 const gfx::RectF& draw_rect = it->first;
31 const SkPaint& paint = it->second; 35 const SkPaint& paint = it->second;
32 canvas->drawRectCoords(draw_rect.x(), 36 canvas->drawRectCoords(draw_rect.x(),
33 draw_rect.y(), 37 draw_rect.y(),
34 draw_rect.right(), 38 draw_rect.right(),
35 draw_rect.bottom(), 39 draw_rect.bottom(),
36 paint); 40 paint);
37 } 41 }
38 42
39 for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); 43 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
40 it != draw_bitmaps_.end(); ++it) { 44 it != draw_bitmaps_.end(); ++it) {
41 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); 45 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint);
42 } 46 }
43 } 47 }
44 48
45 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 49 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
46 50
47 } // namespace cc 51 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698