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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DrawingRecorder.cpp

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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "platform/graphics/paint/DrawingRecorder.h" 5 #include "platform/graphics/paint/DrawingRecorder.h"
6 6
7 #include "platform/RuntimeEnabledFeatures.h" 7 #include "platform/RuntimeEnabledFeatures.h"
8 #include "platform/graphics/GraphicsContext.h" 8 #include "platform/graphics/GraphicsContext.h"
9 #include "platform/graphics/GraphicsLayer.h" 9 #include "platform/graphics/GraphicsLayer.h"
10 #include "platform/graphics/paint/PaintController.h" 10 #include "platform/graphics/paint/PaintController.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 DCHECK(DisplayItem::IsDrawingType(display_item_type)); 44 DCHECK(DisplayItem::IsDrawingType(display_item_type));
45 45
46 #if DCHECK_IS_ON() 46 #if DCHECK_IS_ON()
47 context.SetInDrawingRecorder(true); 47 context.SetInDrawingRecorder(true);
48 #endif 48 #endif
49 49
50 // Use the enclosing int rect, since pixel-snapping may be applied to the 50 // Use the enclosing int rect, since pixel-snapping may be applied to the
51 // bounds of the object during painting. Potentially expanding the cull rect 51 // bounds of the object during painting. Potentially expanding the cull rect
52 // by a pixel or two also does not affect correctness, and is very unlikely to 52 // by a pixel or two also does not affect correctness, and is very unlikely to
53 // matter for performance. 53 // matter for performance.
54 IntRect cull_rect = EnclosingIntRect(float_cull_rect); 54 recording_bounds_ = EnclosingIntRect(float_cull_rect);
55 context.BeginRecording(cull_rect); 55 context.BeginRecording(recording_bounds_);
56 56
57 #if DCHECK_IS_ON() 57 #if DCHECK_IS_ON()
58 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled()) { 58 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled()) {
59 // Skia depends on the cull rect containing all of the display item 59 // Skia depends on the cull rect containing all of the display item
60 // commands. When strict cull rect clipping is enabled, make this explicit. 60 // commands. When strict cull rect clipping is enabled, make this explicit.
61 // This allows us to identify potential incorrect cull rects that might 61 // This allows us to identify potential incorrect cull rects that might
62 // otherwise be masked due to Skia internal optimizations. 62 // otherwise be masked due to Skia internal optimizations.
63 context.Save(); 63 context.Save();
64 // Expand the verification clip by one pixel to account for Skia's 64 // Expand the verification clip by one pixel to account for Skia's
65 // SkCanvas::getClipBounds() expansion, used in testing cull rects. 65 // SkCanvas::getClipBounds() expansion, used in testing cull rects.
66 // TODO(schenney) This is not the best place to do this. Ideally, we would 66 // TODO(schenney) This is not the best place to do this. Ideally, we would
67 // expand by one pixel in device (pixel) space, but to do that we would need 67 // expand by one pixel in device (pixel) space, but to do that we would need
68 // to add the verification mode to Skia. 68 // to add the verification mode to Skia.
69 cull_rect.Inflate(1); 69 IntRect clip_rect = recording_bounds_;
70 context.ClipRect(cull_rect, kNotAntiAliased, SkClipOp::kIntersect); 70 clip_rect.Inflate(1);
71 context.ClipRect(clip_rect, kNotAntiAliased, SkClipOp::kIntersect);
71 } 72 }
72 #endif 73 #endif
73 } 74 }
74 75
75 DrawingRecorder::~DrawingRecorder() { 76 DrawingRecorder::~DrawingRecorder() {
76 if (context_.GetPaintController().DisplayItemConstructionIsDisabled()) 77 if (context_.GetPaintController().DisplayItemConstructionIsDisabled())
77 return; 78 return;
78 79
79 #if DCHECK_IS_ON() 80 #if DCHECK_IS_ON()
80 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled()) 81 if (RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled())
(...skipping 11 matching lines...) Expand all
92 93
93 #if DCHECK_IS_ON() 94 #if DCHECK_IS_ON()
94 if (!RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled() && 95 if (!RuntimeEnabledFeatures::slimmingPaintStrictCullRectClippingEnabled() &&
95 !context_.GetPaintController().IsForPaintRecordBuilder() && 96 !context_.GetPaintController().IsForPaintRecordBuilder() &&
96 display_item_client_.PaintedOutputOfObjectHasNoEffectRegardlessOfSize()) { 97 display_item_client_.PaintedOutputOfObjectHasNoEffectRegardlessOfSize()) {
97 DCHECK_EQ(0u, picture->size()) << display_item_client_.DebugName(); 98 DCHECK_EQ(0u, picture->size()) << display_item_client_.DebugName();
98 } 99 }
99 #endif 100 #endif
100 101
101 context_.GetPaintController().CreateAndAppend<DrawingDisplayItem>( 102 context_.GetPaintController().CreateAndAppend<DrawingDisplayItem>(
102 display_item_client_, display_item_type_, picture, known_to_be_opaque_); 103 display_item_client_, display_item_type_, picture, recording_bounds_,
104 known_to_be_opaque_);
103 } 105 }
104 106
105 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698