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

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

Issue 1198603002: Rename all things "leaky" in SkDevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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') | src/image/SkSurface_Gpu.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 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 fContext = SkRef(rt->getContext()); 143 fContext = SkRef(rt->getContext());
144 fNeedClear = flags & kNeedClear_Flag; 144 fNeedClear = flags & kNeedClear_Flag;
145 145
146 fRenderTarget = SkRef(rt); 146 fRenderTarget = SkRef(rt);
147 147
148 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height); 148 SkImageInfo info = rt->surfacePriv().info().makeWH(width, height);
149 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt)); 149 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (info, rt));
150 fLegacyBitmap.setInfo(info); 150 fLegacyBitmap.setInfo(info);
151 fLegacyBitmap.setPixelRef(pr)->unref(); 151 fLegacyBitmap.setPixelRef(pr)->unref();
152 152
153 fDrawContext.reset(SkRef(fContext->drawContext(&this->getLeakyProperties())) ); 153 fDrawContext.reset(SkRef(fContext->drawContext(&this->surfaceProps())));
154 } 154 }
155 155
156 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted, 156 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted,
157 const SkImageInfo& origInfo, int sampleCount) { 157 const SkImageInfo& origInfo, int sampleCount) {
158 if (kUnknown_SkColorType == origInfo.colorType() || 158 if (kUnknown_SkColorType == origInfo.colorType() ||
159 origInfo.width() < 0 || origInfo.height() < 0) { 159 origInfo.width() < 0 || origInfo.height() < 0) {
160 return NULL; 160 return NULL;
161 } 161 }
162 162
163 if (!context) { 163 if (!context) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 SkASSERT(fRenderTarget != newRT); 329 SkASSERT(fRenderTarget != newRT);
330 330
331 fRenderTarget->unref(); 331 fRenderTarget->unref();
332 fRenderTarget = newRT.detach(); 332 fRenderTarget = newRT.detach();
333 333
334 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); 334 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info());
335 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info (), fRenderTarget)); 335 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info (), fRenderTarget));
336 fLegacyBitmap.setPixelRef(pr)->unref(); 336 fLegacyBitmap.setPixelRef(pr)->unref();
337 337
338 fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext(&this->get LeakyProperties()))); 338 fDrawContext.reset(SkRef(fRenderTarget->getContext()->drawContext(&this->sur faceProps())));
339 } 339 }
340 340
341 /////////////////////////////////////////////////////////////////////////////// 341 ///////////////////////////////////////////////////////////////////////////////
342 342
343 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 343 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
344 CHECK_SHOULD_DRAW(draw); 344 CHECK_SHOULD_DRAW(draw);
345 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); 345 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext);
346 346
347 GrPaint grPaint; 347 GrPaint grPaint;
348 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 348 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) {
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 1224
1225 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture, 1225 bool SkGpuDevice::filterTexture(GrContext* context, GrTexture* texture,
1226 int width, int height, 1226 int width, int height,
1227 const SkImageFilter* filter, 1227 const SkImageFilter* filter,
1228 const SkImageFilter::Context& ctx, 1228 const SkImageFilter::Context& ctx,
1229 SkBitmap* result, SkIPoint* offset) { 1229 SkBitmap* result, SkIPoint* offset) {
1230 SkASSERT(filter); 1230 SkASSERT(filter);
1231 1231
1232 // FIXME: plumb actual surface props such that we don't have to lie about th e flags here 1232 // FIXME: plumb actual surface props such that we don't have to lie about th e flags here
1233 // (https://code.google.com/p/skia/issues/detail?id=3148). 1233 // (https://code.google.com/p/skia/issues/detail?id=3148).
1234 SkImageFilter::Proxy proxy(this, SkSurfaceProps(0, getLeakyProperties().pixe lGeometry())); 1234 SkImageFilter::Proxy proxy(this, SkSurfaceProps(0, this->surfaceProps().pixe lGeometry()));
1235 1235
1236 if (filter->canFilterImageGPU()) { 1236 if (filter->canFilterImageGPU()) {
1237 return filter->filterImageGPU(&proxy, wrap_texture(texture, width, heigh t), 1237 return filter->filterImageGPU(&proxy, wrap_texture(texture, width, heigh t),
1238 ctx, result, offset); 1238 ctx, result, offset);
1239 } else { 1239 } else {
1240 return false; 1240 return false;
1241 } 1241 }
1242 } 1242 }
1243 1243
1244 void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap, 1244 void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 unsigned flags = cinfo.fInfo.isOpaque() ? 0 : kNeedClear_Flag; 1677 unsigned flags = cinfo.fInfo.isOpaque() ? 0 : kNeedClear_Flag;
1678 1678
1679 // layers are never draw in repeat modes, so we can request an approx 1679 // layers are never draw in repeat modes, so we can request an approx
1680 // match and ignore any padding. 1680 // match and ignore any padding.
1681 const GrTextureProvider::ScratchTexMatch match = (kNever_TileUsage == cinfo. fTileUsage) ? 1681 const GrTextureProvider::ScratchTexMatch match = (kNever_TileUsage == cinfo. fTileUsage) ?
1682 GrTextureProvider::kApprox_Scr atchTexMatch : 1682 GrTextureProvider::kApprox_Scr atchTexMatch :
1683 GrTextureProvider::kExact_Scra tchTexMatch; 1683 GrTextureProvider::kExact_Scra tchTexMatch;
1684 texture.reset(fContext->textureProvider()->refScratchTexture(desc, match)); 1684 texture.reset(fContext->textureProvider()->refScratchTexture(desc, match));
1685 1685
1686 if (texture) { 1686 if (texture) {
1687 SkSurfaceProps props(this->getLeakyProperties().flags(), cinfo.fPixelGeo metry); 1687 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry) ;
1688 return SkGpuDevice::Create( 1688 return SkGpuDevice::Create(
1689 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height() , &props, flags); 1689 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height() , &props, flags);
1690 } else { 1690 } else {
1691 SkErrorInternals::SetError( kInternalError_SkError, 1691 SkErrorInternals::SetError( kInternalError_SkError,
1692 "---- failed to create gpu device texture [% d %d]\n", 1692 "---- failed to create gpu device texture [% d %d]\n",
1693 cinfo.fInfo.width(), cinfo.fInfo.height()); 1693 cinfo.fInfo.width(), cinfo.fInfo.height());
1694 return NULL; 1694 return NULL;
1695 } 1695 }
1696 } 1696 }
1697 1697
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 #endif 1769 #endif
1770 } 1770 }
1771 1771
1772 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1772 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1773 // We always return a transient cache, so it is freed after each 1773 // We always return a transient cache, so it is freed after each
1774 // filter traversal. 1774 // filter traversal.
1775 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1775 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1776 } 1776 }
1777 1777
1778 #endif 1778 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698