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 "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 fRenderTarget->unref(); | 340 fRenderTarget->unref(); |
341 fRenderTarget = newRT.detach(); | 341 fRenderTarget = newRT.detach(); |
342 | 342 |
343 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); | 343 SkASSERT(fRenderTarget->surfacePriv().info() == fLegacyBitmap.info()); |
344 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info
(), fRenderTarget)); | 344 SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef, (fRenderTarget->surfacePriv().info
(), fRenderTarget)); |
345 fLegacyBitmap.setPixelRef(pr)->unref(); | 345 fLegacyBitmap.setPixelRef(pr)->unref(); |
346 } | 346 } |
347 | 347 |
348 /////////////////////////////////////////////////////////////////////////////// | 348 /////////////////////////////////////////////////////////////////////////////// |
349 | 349 |
350 SK_COMPILE_ASSERT(SkShader::kNone_BitmapType == 0, shader_type_mismatch); | |
351 SK_COMPILE_ASSERT(SkShader::kDefault_BitmapType == 1, shader_type_mismatch); | |
352 SK_COMPILE_ASSERT(SkShader::kRadial_BitmapType == 2, shader_type_mismatch); | |
353 SK_COMPILE_ASSERT(SkShader::kSweep_BitmapType == 3, shader_type_mismatch); | |
354 SK_COMPILE_ASSERT(SkShader::kTwoPointRadial_BitmapType == 4, | |
355 shader_type_mismatch); | |
356 SK_COMPILE_ASSERT(SkShader::kTwoPointConical_BitmapType == 5, | |
357 shader_type_mismatch); | |
358 SK_COMPILE_ASSERT(SkShader::kLinear_BitmapType == 6, shader_type_mismatch); | |
359 SK_COMPILE_ASSERT(SkShader::kLast_BitmapType == 6, shader_type_mismatch); | |
360 | |
361 /////////////////////////////////////////////////////////////////////////////// | |
362 | |
363 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { | 350 void SkGpuDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { |
364 CHECK_SHOULD_DRAW(draw); | 351 CHECK_SHOULD_DRAW(draw); |
365 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); | 352 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawPaint", fContext); |
366 | 353 |
367 GrPaint grPaint; | 354 GrPaint grPaint; |
368 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { | 355 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t
rue, &grPaint)) { |
369 return; | 356 return; |
370 } | 357 } |
371 | 358 |
372 fContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); | 359 fContext->drawPaint(fRenderTarget, fClip, grPaint, *draw.fMatrix); |
(...skipping 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 #endif | 2030 #endif |
2044 } | 2031 } |
2045 | 2032 |
2046 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 2033 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
2047 // We always return a transient cache, so it is freed after each | 2034 // We always return a transient cache, so it is freed after each |
2048 // filter traversal. | 2035 // filter traversal. |
2049 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 2036 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
2050 } | 2037 } |
2051 | 2038 |
2052 #endif | 2039 #endif |
OLD | NEW |