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

Side by Side Diff: src/core/SkSpecialSurface.cpp

Issue 1972213002: Fix bug & add code to catch ImageFilter clearing bugs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch #define Created 4 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 | « gm/pictureimagefilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file 5 * found in the LICENSE file
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkSpecialImage.h" 9 #include "SkSpecialImage.h"
10 #include "SkSpecialSurface.h" 10 #include "SkSpecialSurface.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 const SkIRect& subset, 67 const SkIRect& subset,
68 const SkSurfaceProps* props) 68 const SkSurfaceProps* props)
69 : INHERITED(subset, props) { 69 : INHERITED(subset, props) {
70 const SkImageInfo& info = pr->info(); 70 const SkImageInfo& info = pr->info();
71 71
72 fBitmap.setInfo(info, info.minRowBytes()); 72 fBitmap.setInfo(info, info.minRowBytes());
73 fBitmap.setPixelRef(pr); 73 fBitmap.setPixelRef(pr);
74 74
75 fCanvas.reset(new SkCanvas(fBitmap, this->props())); 75 fCanvas.reset(new SkCanvas(fBitmap, this->props()));
76 fCanvas->clipRect(SkRect::Make(subset)); 76 fCanvas->clipRect(SkRect::Make(subset));
77 #ifdef SK_IS_BOT
78 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness
79 #endif
77 } 80 }
78 81
79 ~SkSpecialSurface_Raster() override { } 82 ~SkSpecialSurface_Raster() override { }
80 83
81 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { 84 sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
82 return SkSpecialImage::MakeFromRaster(this->subset(), fBitmap, &this->pr ops()); 85 return SkSpecialImage::MakeFromRaster(this->subset(), fBitmap, &this->pr ops());
83 } 86 }
84 87
85 private: 88 private:
86 SkBitmap fBitmap; 89 SkBitmap fBitmap;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 126
124 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(sk_ref_sp(fTexture->asRender Target()), 127 sk_sp<SkGpuDevice> device(SkGpuDevice::Make(sk_ref_sp(fTexture->asRender Target()),
125 width, height, props, 128 width, height, props,
126 SkGpuDevice::kUninit_InitCon tents)); 129 SkGpuDevice::kUninit_InitCon tents));
127 if (!device) { 130 if (!device) {
128 return; 131 return;
129 } 132 }
130 133
131 fCanvas.reset(new SkCanvas(device.get())); 134 fCanvas.reset(new SkCanvas(device.get()));
132 fCanvas->clipRect(SkRect::Make(subset)); 135 fCanvas->clipRect(SkRect::Make(subset));
136 #ifdef SK_IS_BOT
137 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness
138 #endif
133 } 139 }
134 140
135 ~SkSpecialSurface_Gpu() override { } 141 ~SkSpecialSurface_Gpu() override { }
136 142
137 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { 143 sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
138 // Note: we are intentionally zeroing out 'fTexture' here 144 // Note: we are intentionally zeroing out 'fTexture' here
139 return SkSpecialImage::MakeFromGpu(this->subset(), 145 return SkSpecialImage::MakeFromGpu(this->subset(),
140 kNeedNewImageUniqueID_SpecialImage, 146 kNeedNewImageUniqueID_SpecialImage,
141 std::move(fTexture), 147 std::move(fTexture),
142 &this->props()); 148 &this->props());
(...skipping 22 matching lines...) Expand all
165 if (!tex) { 171 if (!tex) {
166 return nullptr; 172 return nullptr;
167 } 173 }
168 174
169 const SkIRect subset = SkIRect::MakeWH(width, height); 175 const SkIRect subset = SkIRect::MakeWH(width, height);
170 176
171 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(tex), width, height, subse t, nullptr); 177 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(tex), width, height, subse t, nullptr);
172 } 178 }
173 179
174 #endif 180 #endif
OLDNEW
« no previous file with comments | « gm/pictureimagefilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698