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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxReflectionUtils.cpp

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: three Rs: rebase, readme, review Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/paint/BoxReflectionUtils.h" 5 #include "core/paint/BoxReflectionUtils.h"
6 6
7 #include "core/layout/LayoutBox.h" 7 #include "core/layout/LayoutBox.h"
8 #include "core/paint/NinePieceImagePainter.h" 8 #include "core/paint/NinePieceImagePainter.h"
9 #include "core/paint/PaintLayer.h" 9 #include "core/paint/PaintLayer.h"
10 #include "platform/LengthFunctions.h" 10 #include "platform/LengthFunctions.h"
(...skipping 29 matching lines...) Expand all
40 direction = BoxReflection::HorizontalReflection; 40 direction = BoxReflection::HorizontalReflection;
41 offset = -floatValueForLength(reflectStyle->offset(), frameRect.width()); 41 offset = -floatValueForLength(reflectStyle->offset(), frameRect.width());
42 break; 42 break;
43 case ReflectionRight: 43 case ReflectionRight:
44 direction = BoxReflection::HorizontalReflection; 44 direction = BoxReflection::HorizontalReflection;
45 offset = 2 * frameRect.width() + 45 offset = 2 * frameRect.width() +
46 floatValueForLength(reflectStyle->offset(), frameRect.width()); 46 floatValueForLength(reflectStyle->offset(), frameRect.width());
47 break; 47 break;
48 } 48 }
49 49
50 sk_sp<SkPicture> mask; 50 sk_sp<PaintRecord> mask;
51 const NinePieceImage& maskNinePiece = reflectStyle->mask(); 51 const NinePieceImage& maskNinePiece = reflectStyle->mask();
52 if (maskNinePiece.hasImage()) { 52 if (maskNinePiece.hasImage()) {
53 LayoutRect maskRect(LayoutPoint(), frameLayoutRect.size()); 53 LayoutRect maskRect(LayoutPoint(), frameLayoutRect.size());
54 LayoutRect maskBoundingRect(maskRect); 54 LayoutRect maskBoundingRect(maskRect);
55 maskBoundingRect.expand(style.imageOutsets(maskNinePiece)); 55 maskBoundingRect.expand(style.imageOutsets(maskNinePiece));
56 FloatRect maskBoundingFloatRect(maskBoundingRect); 56 FloatRect maskBoundingFloatRect(maskBoundingRect);
57 57
58 // TODO(jbroman): SkPictureBuilder + DrawingRecorder seems excessive. 58 // TODO(jbroman): SkPictureBuilder + DrawingRecorder seems excessive.
59 // If NinePieceImagePainter operated on SkCanvas, we'd only need an 59 // If NinePieceImagePainter operated on SkCanvas, we'd only need a
60 // SkPictureRecorder here. 60 // PictureRecorder here.
61 SkPictureBuilder recorder(maskBoundingFloatRect); 61 SkPictureBuilder recorder(maskBoundingFloatRect);
62 { 62 {
63 GraphicsContext& context = recorder.context(); 63 GraphicsContext& context = recorder.context();
64 DrawingRecorder drawingRecorder(context, *layer.layoutObject(), 64 DrawingRecorder drawingRecorder(context, *layer.layoutObject(),
65 DisplayItem::kReflectionMask, 65 DisplayItem::kReflectionMask,
66 maskBoundingFloatRect); 66 maskBoundingFloatRect);
67 NinePieceImagePainter(*layer.layoutObject()) 67 NinePieceImagePainter(*layer.layoutObject())
68 .paint(recorder.context(), maskRect, style, maskNinePiece, 68 .paint(recorder.context(), maskRect, style, maskNinePiece,
69 SkBlendMode::kSrcOver); 69 SkBlendMode::kSrcOver);
70 } 70 }
71 mask = recorder.endRecording(); 71 mask = recorder.endRecording();
72 } 72 }
73 73
74 return BoxReflection(direction, offset, std::move(mask)); 74 return BoxReflection(direction, offset, std::move(mask));
75 } 75 }
76 76
77 } // namespace blink 77 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698