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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 1831603002: Revert of Switch SkBlurImageFilter over to new onFilterImage interface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « src/gpu/SkGpuDevice.h ('k') | 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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 desc.fTextureStorageAllocator = textureStorageAllocator; 214 desc.fTextureStorageAllocator = textureStorageAllocator;
215 desc.fIsMipMapped = false; 215 desc.fIsMipMapped = false;
216 GrTexture* texture = context->textureProvider()->createTexture(desc, budgete d, nullptr, 0); 216 GrTexture* texture = context->textureProvider()->createTexture(desc, budgete d, nullptr, 0);
217 if (nullptr == texture) { 217 if (nullptr == texture) {
218 return nullptr; 218 return nullptr;
219 } 219 }
220 SkASSERT(nullptr != texture->asRenderTarget()); 220 SkASSERT(nullptr != texture->asRenderTarget());
221 return texture->asRenderTarget(); 221 return texture->asRenderTarget();
222 } 222 }
223 223
224 // This method ensures that we always have a texture-backed "bitmap" when we fin ally
225 // call through to the base impl so that the image filtering code will take the
226 // gpu-specific paths. This mirrors SkCanvas::internalDrawDevice (the other
227 // use of SkImageFilter::filterImage) in that the source and dest will have
228 // homogenous backing (e.g., raster or gpu).
229 void SkGpuDevice::drawBitmapAsSpriteWithImageFilter(const SkDraw& draw, const Sk Bitmap& bitmap,
230 int x, int y, const SkPaint& paint) {
231 if (bitmap.getTexture()) {
232 INHERITED::drawBitmapAsSpriteWithImageFilter(draw, bitmap, x, y, paint);
233 return;
234 }
235
236 SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
237 if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
238 return;
239 }
240
241 GrTexture* texture;
242 // draw sprite neither filters nor tiles.
243 AutoBitmapTexture abt(fContext, bitmap, GrTextureParams::ClampNoFilter(), &t exture);
244 if (!texture) {
245 return;
246 }
247
248 SkBitmap newBitmap;
249
250 GrWrapTextureInBitmap(texture, texture->width(), texture->height(),
251 bitmap.isOpaque(), &newBitmap);
252
253 INHERITED::drawBitmapAsSpriteWithImageFilter(draw, newBitmap, x, y, paint);
254 }
255
256 /////////////////////////////////////////////////////////////////////////////// 224 ///////////////////////////////////////////////////////////////////////////////
257 225
258 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes, 226 bool SkGpuDevice::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size _t dstRowBytes,
259 int x, int y) { 227 int x, int y) {
260 ASSERT_SINGLE_OWNER 228 ASSERT_SINGLE_OWNER
261 229
262 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels 230 // TODO: teach fRenderTarget to take ImageInfo directly to specify the src p ixels
263 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps()) ; 231 GrPixelConfig config = SkImageInfo2GrPixelConfig(dstInfo, *fContext->caps()) ;
264 if (kUnknown_GrPixelConfig == config) { 232 if (kUnknown_GrPixelConfig == config) {
265 return false; 233 return false;
(...skipping 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 } 1883 }
1916 1884
1917 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1885 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1918 ASSERT_SINGLE_OWNER 1886 ASSERT_SINGLE_OWNER
1919 // We always return a transient cache, so it is freed after each 1887 // We always return a transient cache, so it is freed after each
1920 // filter traversal. 1888 // filter traversal.
1921 return SkGpuDevice::NewImageFilterCache(); 1889 return SkGpuDevice::NewImageFilterCache();
1922 } 1890 }
1923 1891
1924 #endif 1892 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698