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

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

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all Created 3 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
« no previous file with comments | « cc/paint/record_paint_canvas.cc ('k') | cc/test/solid_color_content_layer_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include "cc/paint/clip_display_item.h" 9 #include "cc/paint/clip_display_item.h"
10 #include "cc/paint/drawing_display_item.h" 10 #include "cc/paint/drawing_display_item.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 PaintRecorder recorder; 53 PaintRecorder recorder;
54 54
55 for (RectPaintVector::const_iterator it = draw_rects_.begin(); 55 for (RectPaintVector::const_iterator it = draw_rects_.begin();
56 it != draw_rects_.end(); ++it) { 56 it != draw_rects_.end(); ++it) {
57 const gfx::RectF& draw_rect = it->first; 57 const gfx::RectF& draw_rect = it->first;
58 const PaintFlags& flags = it->second; 58 const PaintFlags& flags = it->second;
59 PaintCanvas* canvas = 59 PaintCanvas* canvas =
60 recorder.beginRecording(gfx::RectFToSkRect(draw_rect)); 60 recorder.beginRecording(gfx::RectFToSkRect(draw_rect));
61 canvas->drawRect(gfx::RectFToSkRect(draw_rect), flags); 61 canvas->drawRect(gfx::RectFToSkRect(draw_rect), flags);
62 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( 62 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
63 ToEnclosingRect(draw_rect), recorder.finishRecordingAsPicture()); 63 ToEnclosingRect(draw_rect), recorder.finishRecordingAsPicture(),
64 gfx::RectFToSkRect(draw_rect));
64 } 65 }
65 66
66 for (ImageVector::const_iterator it = draw_images_.begin(); 67 for (ImageVector::const_iterator it = draw_images_.begin();
67 it != draw_images_.end(); ++it) { 68 it != draw_images_.end(); ++it) {
68 if (!it->transform.IsIdentity()) { 69 if (!it->transform.IsIdentity()) {
69 display_list->CreateAndAppendPairedBeginItem<TransformDisplayItem>( 70 display_list->CreateAndAppendPairedBeginItem<TransformDisplayItem>(
70 it->transform); 71 it->transform);
71 } 72 }
72 PaintCanvas* canvas = recorder.beginRecording( 73 PaintCanvas* canvas =
73 it->image.sk_image()->width(), it->image.sk_image()->height()); 74 recorder.beginRecording(gfx::RectToSkRect(PaintableRegion()));
74 canvas->drawImage(it->image, it->point.x(), it->point.y(), &it->flags); 75 canvas->drawImage(it->image, it->point.x(), it->point.y(), &it->flags);
75 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( 76 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
76 PaintableRegion(), recorder.finishRecordingAsPicture()); 77 PaintableRegion(), recorder.finishRecordingAsPicture(),
78 gfx::RectToSkRect(PaintableRegion()));
77 if (!it->transform.IsIdentity()) { 79 if (!it->transform.IsIdentity()) {
78 display_list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>(); 80 display_list->CreateAndAppendPairedEndItem<EndTransformDisplayItem>();
79 } 81 }
80 } 82 }
81 83
82 if (fill_with_nonsolid_color_) { 84 if (fill_with_nonsolid_color_) {
83 gfx::Rect draw_rect = PaintableRegion(); 85 gfx::Rect draw_rect = PaintableRegion();
84 bool red = true; 86 bool red = true;
85 while (!draw_rect.IsEmpty()) { 87 while (!draw_rect.IsEmpty()) {
86 PaintFlags flags; 88 PaintFlags flags;
87 flags.setColor(red ? SK_ColorRED : SK_ColorBLUE); 89 flags.setColor(red ? SK_ColorRED : SK_ColorBLUE);
88 PaintCanvas* canvas = 90 PaintCanvas* canvas =
89 recorder.beginRecording(gfx::RectToSkRect(draw_rect)); 91 recorder.beginRecording(gfx::RectToSkRect(draw_rect));
90 canvas->drawIRect(gfx::RectToSkIRect(draw_rect), flags); 92 canvas->drawIRect(gfx::RectToSkIRect(draw_rect), flags);
91 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>( 93 display_list->CreateAndAppendDrawingItem<DrawingDisplayItem>(
92 draw_rect, recorder.finishRecordingAsPicture()); 94 draw_rect, recorder.finishRecordingAsPicture(),
95 gfx::RectToSkRect(draw_rect));
93 draw_rect.Inset(1, 1); 96 draw_rect.Inset(1, 1);
94 } 97 }
95 } 98 }
96 99
97 display_list->Finalize(); 100 display_list->Finalize();
98 return display_list; 101 return display_list;
99 } 102 }
100 103
101 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; } 104 bool FakeContentLayerClient::FillsBoundsCompletely() const { return false; }
102 105
103 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const { 106 size_t FakeContentLayerClient::GetApproximateUnsharedMemoryUsage() const {
104 return reported_memory_usage_; 107 return reported_memory_usage_;
105 } 108 }
106 109
107 } // namespace cc 110 } // namespace cc
OLDNEW
« no previous file with comments | « cc/paint/record_paint_canvas.cc ('k') | cc/test/solid_color_content_layer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698