OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrCaps.h" | 8 #include "GrCaps.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 153 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
154 | 154 |
155 class SkGpuImageFilterProxy : public SkImageFilter::Proxy { | 155 class SkGpuImageFilterProxy : public SkImageFilter::Proxy { |
156 GrContext* fCtx; | 156 GrContext* fCtx; |
157 | 157 |
158 public: | 158 public: |
159 SkGpuImageFilterProxy(GrContext* ctx) : fCtx(ctx) {} | 159 SkGpuImageFilterProxy(GrContext* ctx) : fCtx(ctx) {} |
160 | 160 |
161 SkBaseDevice* createDevice(int width, int height) override { | 161 SkBaseDevice* createDevice(int width, int height, bool tile) override { |
162 GrSurfaceDesc desc; | 162 GrSurfaceDesc desc; |
163 desc.fConfig = kSkia8888_GrPixelConfig; | 163 desc.fConfig = kSkia8888_GrPixelConfig; |
164 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 164 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
165 desc.fWidth = width; | 165 desc.fWidth = width; |
166 desc.fHeight = height; | 166 desc.fHeight = height; |
167 desc.fSampleCnt = 0; | 167 desc.fSampleCnt = 0; |
168 | 168 |
| 169 // For now, we ignore the tile param and always allocate tileable |
| 170 // textures. |
169 SkAutoTUnref<GrTexture> texture(fCtx->textureProvider()->createTexture(d
esc, true)); | 171 SkAutoTUnref<GrTexture> texture(fCtx->textureProvider()->createTexture(d
esc, true)); |
170 | 172 |
171 if (texture) { | 173 if (texture) { |
172 SkSurfaceProps props(0, kUnknown_SkPixelGeometry); | 174 SkSurfaceProps props(0, kUnknown_SkPixelGeometry); |
173 return SkGpuDevice::Create(texture->asRenderTarget(), width, height,
&props, | 175 return SkGpuDevice::Create(texture->asRenderTarget(), width, height,
&props, |
174 SkGpuDevice::kClear_InitContents); | 176 SkGpuDevice::kClear_InitContents); |
175 } else { | 177 } else { |
176 return nullptr; | 178 return nullptr; |
177 } | 179 } |
178 } | 180 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 if (!dst) { | 370 if (!dst) { |
369 return nullptr; | 371 return nullptr; |
370 } | 372 } |
371 | 373 |
372 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 374 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
373 const SkIPoint dstP = SkIPoint::Make(0, 0); | 375 const SkIPoint dstP = SkIPoint::Make(0, 0); |
374 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 376 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
375 return dst; | 377 return dst; |
376 } | 378 } |
377 | 379 |
OLD | NEW |