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

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

Issue 1903553002: Add explicit clip to SkSpecialSurface's SkCanvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Eerrggh Created 4 years, 8 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 | « no previous file | no next file » | 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 SkPixelRef* pr, 70 SkPixelRef* pr,
71 const SkIRect& subset, 71 const SkIRect& subset,
72 const SkSurfaceProps* props) 72 const SkSurfaceProps* props)
73 : INHERITED(proxy, subset, props) { 73 : INHERITED(proxy, subset, props) {
74 const SkImageInfo& info = pr->info(); 74 const SkImageInfo& info = pr->info();
75 75
76 fBitmap.setInfo(info, info.minRowBytes()); 76 fBitmap.setInfo(info, info.minRowBytes());
77 fBitmap.setPixelRef(pr); 77 fBitmap.setPixelRef(pr);
78 78
79 fCanvas.reset(new SkCanvas(fBitmap, this->props())); 79 fCanvas.reset(new SkCanvas(fBitmap, this->props()));
80 fCanvas->clipRect(SkRect::Make(subset));
80 } 81 }
81 82
82 ~SkSpecialSurface_Raster() override { } 83 ~SkSpecialSurface_Raster() override { }
83 84
84 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { 85 sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
85 return SkSpecialImage::MakeFromRaster(this->proxy(), this->subset(), fBi tmap, 86 return SkSpecialImage::MakeFromRaster(this->proxy(), this->subset(), fBi tmap,
86 &this->props()); 87 &this->props());
87 } 88 }
88 89
89 private: 90 private:
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 SkASSERT(fTexture->asRenderTarget()); 129 SkASSERT(fTexture->asRenderTarget());
129 130
130 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(fTexture->asRenderT arget(), props, 131 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(fTexture->asRenderT arget(), props,
131 SkGpuDevice::kUnini t_InitContents)); 132 SkGpuDevice::kUnini t_InitContents));
132 if (!device) { 133 if (!device) {
133 return; 134 return;
134 } 135 }
135 136
136 fCanvas.reset(new SkCanvas(device)); 137 fCanvas.reset(new SkCanvas(device));
138 fCanvas->clipRect(SkRect::Make(subset));
137 } 139 }
138 140
139 ~SkSpecialSurface_Gpu() override { } 141 ~SkSpecialSurface_Gpu() override { }
140 142
141 sk_sp<SkSpecialImage> onMakeImageSnapshot() override { 143 sk_sp<SkSpecialImage> onMakeImageSnapshot() override {
142 return SkSpecialImage::MakeFromGpu(this->proxy(), this->subset(), 144 return SkSpecialImage::MakeFromGpu(this->proxy(), this->subset(),
143 kNeedNewImageUniqueID_SpecialImage, f Texture, 145 kNeedNewImageUniqueID_SpecialImage, f Texture,
144 &this->props()); 146 &this->props());
145 } 147 }
146 148
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 191 }
190 192
191 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy* proxy, 193 sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(SkImageFilter::Proxy* proxy,
192 GrContext* context, 194 GrContext* context,
193 const GrSurfaceDesc& desc, 195 const GrSurfaceDesc& desc,
194 const SkSurfaceProps* props) { 196 const SkSurfaceProps* props) {
195 return nullptr; 197 return nullptr;
196 } 198 }
197 199
198 #endif 200 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698