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 | |
947 device = device->onCreateDevice(SkBaseDevice::CreateInfo(info, usage, geo),
paint); | 939 device = device->onCreateDevice(SkBaseDevice::CreateInfo(info, usage, geo),
paint); |
948 if (NULL == device) { | 940 if (NULL == device) { |
949 SkErrorInternals::SetError( kInternalError_SkError, | 941 SkErrorInternals::SetError( kInternalError_SkError, |
950 "Unable to create device for layer."); | 942 "Unable to create device for layer."); |
951 return; | 943 return; |
952 } | 944 } |
953 | 945 |
954 device->setOrigin(ir.fLeft, ir.fTop); | 946 device->setOrigin(ir.fLeft, ir.fTop); |
955 DeviceCM* layer = SkNEW_ARGS(DeviceCM, (device, paint, this, fConservativeRa
sterClip)); | 947 DeviceCM* layer = SkNEW_ARGS(DeviceCM, (device, paint, this, fConservativeRa
sterClip)); |
956 device->unref(); | 948 device->unref(); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2520 } | 2512 } |
2521 | 2513 |
2522 if (matrix) { | 2514 if (matrix) { |
2523 canvas->concat(*matrix); | 2515 canvas->concat(*matrix); |
2524 } | 2516 } |
2525 } | 2517 } |
2526 | 2518 |
2527 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2519 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2528 fCanvas->restoreToCount(fSaveCount); | 2520 fCanvas->restoreToCount(fSaveCount); |
2529 } | 2521 } |
OLD | NEW |