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

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

Issue 2163323002: Add desired width & height to drawContext (as opposed to using the width & height of the RT) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More Clean up Created 4 years, 5 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 | « include/gpu/GrDrawContext.h ('k') | src/effects/SkGpuBlurUtils.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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 return sk_make_sp<SkSpecialSurface_Raster>(pr, subset, props); 108 return sk_make_sp<SkSpecialSurface_Raster>(pr, subset, props);
109 } 109 }
110 110
111 #if SK_SUPPORT_GPU 111 #if SK_SUPPORT_GPU
112 /////////////////////////////////////////////////////////////////////////////// 112 ///////////////////////////////////////////////////////////////////////////////
113 #include "GrContext.h" 113 #include "GrContext.h"
114 #include "SkGpuDevice.h" 114 #include "SkGpuDevice.h"
115 115
116 class SkSpecialSurface_Gpu : public SkSpecialSurface_Base { 116 class SkSpecialSurface_Gpu : public SkSpecialSurface_Base {
117 public: 117 public:
118 SkSpecialSurface_Gpu(sk_sp<GrDrawContext> drawContext, 118 SkSpecialSurface_Gpu(sk_sp<GrDrawContext> drawContext, const SkIRect& subset )
119 int width, int height,
120 const SkIRect& subset)
121 : INHERITED(subset, &drawContext->surfaceProps()) 119 : INHERITED(subset, &drawContext->surfaceProps())
122 , fDrawContext(std::move(drawContext)) { 120 , fDrawContext(std::move(drawContext)) {
123 121
124 sk_sp<SkBaseDevice> device(SkGpuDevice::Make(fDrawContext, width, height , 122 sk_sp<SkBaseDevice> device(SkGpuDevice::Make(fDrawContext,
125 SkGpuDevice::kUninit_InitCo ntents)); 123 SkGpuDevice::kUninit_InitCo ntents));
126 if (!device) { 124 if (!device) {
127 return; 125 return;
128 } 126 }
129 127
130 fCanvas.reset(new SkCanvas(device.get())); 128 fCanvas.reset(new SkCanvas(device.get()));
131 fCanvas->clipRect(SkRect::Make(subset)); 129 fCanvas->clipRect(SkRect::Make(subset));
132 #ifdef SK_IS_BOT 130 #ifdef SK_IS_BOT
133 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness 131 fCanvas->clear(SK_ColorRED); // catch any imageFilter sloppiness
134 #endif 132 #endif
(...skipping 24 matching lines...) Expand all
159 } 157 }
160 158
161 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox, 159 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kAppr ox,
162 width, height, conf ig)); 160 width, height, conf ig));
163 if (!drawContext) { 161 if (!drawContext) {
164 return nullptr; 162 return nullptr;
165 } 163 }
166 164
167 const SkIRect subset = SkIRect::MakeWH(width, height); 165 const SkIRect subset = SkIRect::MakeWH(width, height);
168 166
169 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), width, heigh t, subset); 167 return sk_make_sp<SkSpecialSurface_Gpu>(std::move(drawContext), subset);
170 } 168 }
171 169
172 #endif 170 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrDrawContext.h ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698