OLD | NEW |
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 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1374 | 1374 |
1375 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring | 1375 // Construct a GrPaint by setting the bitmap texture as the first effect and
then configuring |
1376 // the rest from the SkPaint. | 1376 // the rest from the SkPaint. |
1377 GrPaint grPaint; | 1377 GrPaint grPaint; |
1378 grPaint.addColorEffect(effect); | 1378 grPaint.addColorEffect(effect); |
1379 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); | 1379 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType()); |
1380 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : | 1380 GrColor paintColor = (alphaOnly) ? SkColor2GrColorJustAlpha(paint.getColor()
) : |
1381 SkColor2GrColor(paint.getColor()); | 1381 SkColor2GrColor(paint.getColor()); |
1382 SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint)
; | 1382 SkPaint2GrPaintNoShader(this->context(), paint, paintColor, false, &grPaint)
; |
1383 | 1383 |
1384 fContext->drawRectToRect(grPaint, dstRect, paintRect, NULL); | 1384 fContext->drawRectToRect(grPaint, dstRect, paintRect); |
1385 } | 1385 } |
1386 | 1386 |
1387 static bool filter_texture(SkBaseDevice* device, GrContext* context, | 1387 static bool filter_texture(SkBaseDevice* device, GrContext* context, |
1388 GrTexture* texture, const SkImageFilter* filter, | 1388 GrTexture* texture, const SkImageFilter* filter, |
1389 int w, int h, const SkImageFilter::Context& ctx, | 1389 int w, int h, const SkImageFilter::Context& ctx, |
1390 SkBitmap* result, SkIPoint* offset) { | 1390 SkBitmap* result, SkIPoint* offset) { |
1391 SkASSERT(filter); | 1391 SkASSERT(filter); |
1392 SkDeviceImageFilterProxy proxy(device); | 1392 SkDeviceImageFilterProxy proxy(device); |
1393 | 1393 |
1394 if (filter->canFilterImageGPU()) { | 1394 if (filter->canFilterImageGPU()) { |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2123 } | 2123 } |
2124 | 2124 |
2125 return true; | 2125 return true; |
2126 } | 2126 } |
2127 | 2127 |
2128 SkImageFilter::UniqueIDCache* SkGpuDevice::getImageFilterCache() { | 2128 SkImageFilter::UniqueIDCache* SkGpuDevice::getImageFilterCache() { |
2129 // We always return a transient cache, so it is freed after each | 2129 // We always return a transient cache, so it is freed after each |
2130 // filter traversal. | 2130 // filter traversal. |
2131 return SkImageFilter::UniqueIDCache::Create(kDefaultImageFilterCacheSize); | 2131 return SkImageFilter::UniqueIDCache::Create(kDefaultImageFilterCacheSize); |
2132 } | 2132 } |
OLD | NEW |