OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCanvasPriv.h" | 9 #include "SkCanvasPriv.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 SkImageInfo info = SkImageInfo::MakeN32(ir.width(), ir.height(), | 929 SkImageInfo info = SkImageInfo::MakeN32(ir.width(), ir.height(), |
930 isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); | 930 isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType); |
931 | 931 |
932 SkBaseDevice* device = this->getTopDevice(); | 932 SkBaseDevice* device = this->getTopDevice(); |
933 if (NULL == device) { | 933 if (NULL == device) { |
934 SkDebugf("Unable to find device for layer."); | 934 SkDebugf("Unable to find device for layer."); |
935 return; | 935 return; |
936 } | 936 } |
937 | 937 |
938 SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage; | 938 SkBaseDevice::TileUsage usage = SkBaseDevice::kNever_TileUsage; |
| 939 #if 1 |
| 940 // this seems needed for current GMs, but makes us draw slower on the GPU |
| 941 // Related to https://code.google.com/p/skia/issues/detail?id=3519 ? |
| 942 // |
| 943 if (paint && paint->getImageFilter()) { |
| 944 usage = SkBaseDevice::kPossible_TileUsage; |
| 945 } |
| 946 #endif |
939 device = device->onCreateDevice(SkBaseDevice::CreateInfo(info, usage, geo),
paint); | 947 device = device->onCreateDevice(SkBaseDevice::CreateInfo(info, usage, geo),
paint); |
940 if (NULL == device) { | 948 if (NULL == device) { |
941 SkErrorInternals::SetError( kInternalError_SkError, | 949 SkErrorInternals::SetError( kInternalError_SkError, |
942 "Unable to create device for layer."); | 950 "Unable to create device for layer."); |
943 return; | 951 return; |
944 } | 952 } |
945 | 953 |
946 device->setOrigin(ir.fLeft, ir.fTop); | 954 device->setOrigin(ir.fLeft, ir.fTop); |
947 DeviceCM* layer = SkNEW_ARGS(DeviceCM, (device, paint, this, fConservativeRa
sterClip)); | 955 DeviceCM* layer = SkNEW_ARGS(DeviceCM, (device, paint, this, fConservativeRa
sterClip)); |
948 device->unref(); | 956 device->unref(); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 } | 2520 } |
2513 | 2521 |
2514 if (matrix) { | 2522 if (matrix) { |
2515 canvas->concat(*matrix); | 2523 canvas->concat(*matrix); |
2516 } | 2524 } |
2517 } | 2525 } |
2518 | 2526 |
2519 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2527 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2520 fCanvas->restoreToCount(fSaveCount); | 2528 fCanvas->restoreToCount(fSaveCount); |
2521 } | 2529 } |
OLD | NEW |