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

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

Issue 148883011: Make SkImageFilter methods const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More fixes to gm/ Created 6 years, 10 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/effects/SkXfermodeImageFilter.cpp ('k') | src/pdf/SkPDFDevice.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 "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 grPaint.addColorEffect(effect); 1508 grPaint.addColorEffect(effect);
1509 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config()); 1509 bool alphaOnly = !(SkBitmap::kA8_Config == bitmap.config());
1510 if (!skPaint2GrPaintNoShader(this, paint, alphaOnly, false, &grPaint)) { 1510 if (!skPaint2GrPaintNoShader(this, paint, alphaOnly, false, &grPaint)) {
1511 return; 1511 return;
1512 } 1512 }
1513 1513
1514 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); 1514 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL);
1515 } 1515 }
1516 1516
1517 static bool filter_texture(SkBaseDevice* device, GrContext* context, 1517 static bool filter_texture(SkBaseDevice* device, GrContext* context,
1518 GrTexture* texture, SkImageFilter* filter, 1518 GrTexture* texture, const SkImageFilter* filter,
1519 int w, int h, const SkMatrix& ctm, SkBitmap* result, 1519 int w, int h, const SkMatrix& ctm, SkBitmap* result,
1520 SkIPoint* offset) { 1520 SkIPoint* offset) {
1521 SkASSERT(filter); 1521 SkASSERT(filter);
1522 SkDeviceImageFilterProxy proxy(device); 1522 SkDeviceImageFilterProxy proxy(device);
1523 1523
1524 if (filter->canFilterImageGPU()) { 1524 if (filter->canFilterImageGPU()) {
1525 // Save the render target and set it to NULL, so we don't accidentally d raw to it in the 1525 // Save the render target and set it to NULL, so we don't accidentally d raw to it in the
1526 // filter. Also set the clip wide open and the matrix to identity. 1526 // filter. Also set the clip wide open and the matrix to identity.
1527 GrContext::AutoWideOpenIdentityDraw awo(context, NULL); 1527 GrContext::AutoWideOpenIdentityDraw awo(context, NULL);
1528 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctm, result , offset); 1528 return filter->filterImageGPU(&proxy, wrap_texture(texture), ctm, result , offset);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 SkIntToScalar(h)); 1687 SkIntToScalar(h));
1688 1688
1689 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate 1689 // The device being drawn may not fill up its texture (e.g. saveLayer uses a pproximate
1690 // scratch texture). 1690 // scratch texture).
1691 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(), 1691 SkRect srcRect = SkRect::MakeWH(SK_Scalar1 * w / devTex->width(),
1692 SK_Scalar1 * h / devTex->height()); 1692 SK_Scalar1 * h / devTex->height());
1693 1693
1694 fContext->drawRectToRect(grPaint, dstRect, srcRect); 1694 fContext->drawRectToRect(grPaint, dstRect, srcRect);
1695 } 1695 }
1696 1696
1697 bool SkGpuDevice::canHandleImageFilter(SkImageFilter* filter) { 1697 bool SkGpuDevice::canHandleImageFilter(const SkImageFilter* filter) {
1698 return filter->canFilterImageGPU(); 1698 return filter->canFilterImageGPU();
1699 } 1699 }
1700 1700
1701 bool SkGpuDevice::filterImage(SkImageFilter* filter, const SkBitmap& src, 1701 bool SkGpuDevice::filterImage(const SkImageFilter* filter, const SkBitmap& src,
1702 const SkMatrix& ctm, 1702 const SkMatrix& ctm,
1703 SkBitmap* result, SkIPoint* offset) { 1703 SkBitmap* result, SkIPoint* offset) {
1704 // want explicitly our impl, so guard against a subclass of us overriding it 1704 // want explicitly our impl, so guard against a subclass of us overriding it
1705 if (!this->SkGpuDevice::canHandleImageFilter(filter)) { 1705 if (!this->SkGpuDevice::canHandleImageFilter(filter)) {
1706 return false; 1706 return false;
1707 } 1707 }
1708 1708
1709 SkAutoLockPixels alp(src, !src.getTexture()); 1709 SkAutoLockPixels alp(src, !src.getTexture());
1710 if (!src.getTexture() && !src.readyToDraw()) { 1710 if (!src.getTexture() && !src.readyToDraw()) {
1711 return false; 1711 return false;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 GrTexture* texture, 1922 GrTexture* texture,
1923 bool needClear) 1923 bool needClear)
1924 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1924 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1925 1925
1926 SkASSERT(texture && texture->asRenderTarget()); 1926 SkASSERT(texture && texture->asRenderTarget());
1927 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1927 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1928 // cache. We pass true for the third argument so that it will get unlocked. 1928 // cache. We pass true for the third argument so that it will get unlocked.
1929 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1929 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1930 fNeedClear = needClear; 1930 fNeedClear = needClear;
1931 } 1931 }
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698