OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "GrSWMaskHelper.h" | 8 #include "GrSWMaskHelper.h" |
9 | 9 |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Can we create a blitter? | 192 // Can we create a blitter? |
193 if (SkTextureCompressor::ExistsBlitterForFormat(fCompressedFormat)) { | 193 if (SkTextureCompressor::ExistsBlitterForFormat(fCompressedFormat)) { |
194 int cmpSz = SkTextureCompressor::GetCompressedDataSize( | 194 int cmpSz = SkTextureCompressor::GetCompressedDataSize( |
195 fCompressedFormat, cmpWidth, cmpHeight); | 195 fCompressedFormat, cmpWidth, cmpHeight); |
196 | 196 |
197 SkASSERT(cmpSz > 0); | 197 SkASSERT(cmpSz > 0); |
198 SkASSERT(nullptr == fCompressedBuffer.get()); | 198 SkASSERT(nullptr == fCompressedBuffer.get()); |
199 fCompressedBuffer.reset(cmpSz); | 199 fCompressedBuffer.reset(cmpSz); |
200 fCompressionMode = kBlitter_CompressionMode; | 200 fCompressionMode = kBlitter_CompressionMode; |
201 } | 201 } |
202 } | 202 } |
203 | 203 |
204 sk_bzero(&fDraw, sizeof(fDraw)); | 204 sk_bzero(&fDraw, sizeof(fDraw)); |
205 | 205 |
206 // If we don't have a custom blitter, then we either need a bitmap to compre
ss | 206 // If we don't have a custom blitter, then we either need a bitmap to compre
ss |
207 // from or a bitmap that we're going to use as a texture. In any case, we sh
ould | 207 // from or a bitmap that we're going to use as a texture. In any case, we sh
ould |
208 // allocate the pixels for a bitmap | 208 // allocate the pixels for a bitmap |
209 const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight); | 209 const SkImageInfo bmImageInfo = SkImageInfo::MakeA8(cmpWidth, cmpHeight); |
210 if (kBlitter_CompressionMode != fCompressionMode) { | 210 if (kBlitter_CompressionMode != fCompressionMode) { |
211 if (!fPixels.tryAlloc(bmImageInfo)) { | 211 if (!fPixels.tryAlloc(bmImageInfo)) { |
212 return false; | 212 return false; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 pipelineBuilder->addCoverageFragmentProcessor( | 361 pipelineBuilder->addCoverageFragmentProcessor( |
362 GrSimpleTextureEffect::Create(texture, | 362 GrSimpleTextureEffect::Create(texture, |
363 maskMatrix, | 363 maskMatrix, |
364 GrTextureParams::kNone_Fi
lterMode, | 364 GrTextureParams::kNone_Fi
lterMode, |
365 kDevice_GrCoordSet))->unr
ef(); | 365 kDevice_GrCoordSet))->unr
ef(); |
366 | 366 |
367 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S
kMatrix::I(), | 367 SkAutoTUnref<GrDrawBatch> batch(GrRectBatchFactory::CreateNonAAFill(color, S
kMatrix::I(), |
368 dstRect,
nullptr, &invert)); | 368 dstRect,
nullptr, &invert)); |
369 target->drawBatch(*pipelineBuilder, batch); | 369 target->drawBatch(*pipelineBuilder, batch); |
370 } | 370 } |
OLD | NEW |