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

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: Addressed comments 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 gc_status) {
20 last_canvas_ = canvas; 23 last_canvas_ = canvas;
21 if (!canvas) 24 last_context_status_ = gc_status;
22 return;
23 25
24 if (paint_all_opaque_) 26 if (paint_all_opaque_)
25 *opaque_rect = paint_rect; 27 *opaque_rect = paint_rect;
26 28
27 canvas->clipRect(gfx::RectToSkRect(paint_rect)); 29 canvas->clipRect(gfx::RectToSkRect(paint_rect));
28 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 30 for (RectPaintVector::const_iterator it = draw_rects_.begin();
29 it != draw_rects_.end(); ++it) { 31 it != draw_rects_.end(); ++it) {
30 const gfx::RectF& draw_rect = it->first; 32 const gfx::RectF& draw_rect = it->first;
31 const SkPaint& paint = it->second; 33 const SkPaint& paint = it->second;
32 canvas->drawRectCoords(draw_rect.x(), 34 canvas->drawRectCoords(draw_rect.x(),
33 draw_rect.y(), 35 draw_rect.y(),
34 draw_rect.right(), 36 draw_rect.right(),
35 draw_rect.bottom(), 37 draw_rect.bottom(),
36 paint); 38 paint);
37 } 39 }
38 40
39 for (BitmapVector::const_iterator it = draw_bitmaps_.begin(); 41 for (BitmapVector::const_iterator it = draw_bitmaps_.begin();
40 it != draw_bitmaps_.end(); ++it) { 42 it != draw_bitmaps_.end(); ++it) {
41 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint); 43 canvas->drawBitmap(it->bitmap, it->point.x(), it->point.y(), &it->paint);
42 } 44 }
43 } 45 }
44 46
45 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 47 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
46 48
47 } // namespace cc 49 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698