Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/core/SkScalerContext.cpp

Issue 728673002: remove unused kLCD_MaskFormat (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove associated Gr enum Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkScalerContext.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkScalerContext.h" 10 #include "SkScalerContext.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 goto SK_ERROR; 174 goto SK_ERROR;
175 } 175 }
176 glyph->fLeft = ir.fLeft; 176 glyph->fLeft = ir.fLeft;
177 glyph->fTop = ir.fTop; 177 glyph->fTop = ir.fTop;
178 glyph->fWidth = SkToU16(ir.width()); 178 glyph->fWidth = SkToU16(ir.width());
179 glyph->fHeight = SkToU16(ir.height()); 179 glyph->fHeight = SkToU16(ir.height());
180 180
181 if (glyph->fWidth > 0) { 181 if (glyph->fWidth > 0) {
182 switch (fRec.fMaskFormat) { 182 switch (fRec.fMaskFormat) {
183 case SkMask::kLCD16_Format: 183 case SkMask::kLCD16_Format:
184 case SkMask::kLCD32_Format:
185 glyph->fWidth += 2; 184 glyph->fWidth += 2;
186 glyph->fLeft -= 1; 185 glyph->fLeft -= 1;
187 break; 186 break;
188 default: 187 default:
189 break; 188 break;
190 } 189 }
191 } 190 }
192 } 191 }
193 } 192 }
194 193
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(fir[2], maskPreBlend.fB); 317 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(fir[2], maskPreBlend.fB);
319 #if SK_SHOW_TEXT_BLIT_COVERAGE 318 #if SK_SHOW_TEXT_BLIT_COVERAGE
320 r = SkMax32(r, 10); g = SkMax32(g, 10); b = SkMax32(b, 10); 319 r = SkMax32(r, 10); g = SkMax32(g, 10); b = SkMax32(b, 10);
321 #endif 320 #endif
322 dstP[pixel_x] = SkPack888ToRGB16(r, g, b); 321 dstP[pixel_x] = SkPack888ToRGB16(r, g, b);
323 } 322 }
324 dstP = (uint16_t*)((char*)dstP + dstRB); 323 dstP = (uint16_t*)((char*)dstP + dstRB);
325 } 324 }
326 } 325 }
327 326
328 template<bool APPLY_PREBLEND>
329 static void pack4xHToLCD32(const SkBitmap& src, const SkMask& dst,
330 const SkMaskGamma::PreBlend& maskPreBlend) {
331 SkASSERT(kAlpha_8_SkColorType == src.colorType());
332 SkASSERT(SkMask::kLCD32_Format == dst.fFormat);
333
334 const int width = dst.fBounds.width();
335 const int height = dst.fBounds.height();
336 SkPMColor* dstP = (SkPMColor*)dst.fImage;
337 size_t dstRB = dst.fRowBytes;
338
339 for (int y = 0; y < height; ++y) {
340 const uint8_t* srcP = src.getAddr8(0, y);
341
342 // TODO: need to use fir filter here as well.
343 for (int x = 0; x < width; ++x) {
344 U8CPU r = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fR);
345 U8CPU g = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fG);
346 U8CPU b = sk_apply_lut_if<APPLY_PREBLEND>(*srcP++, maskPreBlend.fB);
347 dstP[x] = SkPackARGB32(0xFF, r, g, b);
348 }
349 dstP = (SkPMColor*)((char*)dstP + dstRB);
350 }
351 }
352
353 static inline int convert_8_to_1(unsigned byte) { 327 static inline int convert_8_to_1(unsigned byte) {
354 SkASSERT(byte <= 0xFF); 328 SkASSERT(byte <= 0xFF);
355 return byte >> 7; 329 return byte >> 7;
356 } 330 }
357 331
358 static uint8_t pack_8_to_1(const uint8_t alpha[8]) { 332 static uint8_t pack_8_to_1(const uint8_t alpha[8]) {
359 unsigned bits = 0; 333 unsigned bits = 0;
360 for (int i = 0; i < 8; ++i) { 334 for (int i = 0; i < 8; ++i) {
361 bits <<= 1; 335 bits <<= 1;
362 bits |= convert_8_to_1(alpha[i]); 336 bits |= convert_8_to_1(alpha[i]);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 -SkIntToScalar(mask.fBounds.fTop)); 385 -SkIntToScalar(mask.fBounds.fTop));
412 386
413 paint.setAntiAlias(SkMask::kBW_Format != mask.fFormat); 387 paint.setAntiAlias(SkMask::kBW_Format != mask.fFormat);
414 switch (mask.fFormat) { 388 switch (mask.fFormat) {
415 case SkMask::kBW_Format: 389 case SkMask::kBW_Format:
416 dstRB = 0; // signals we need a copy 390 dstRB = 0; // signals we need a copy
417 break; 391 break;
418 case SkMask::kA8_Format: 392 case SkMask::kA8_Format:
419 break; 393 break;
420 case SkMask::kLCD16_Format: 394 case SkMask::kLCD16_Format:
421 case SkMask::kLCD32_Format:
422 // TODO: trigger off LCD orientation 395 // TODO: trigger off LCD orientation
423 dstW = 4*dstW - 8; 396 dstW = 4*dstW - 8;
424 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft + 1), 397 matrix.setTranslate(-SkIntToScalar(mask.fBounds.fLeft + 1),
425 -SkIntToScalar(mask.fBounds.fTop)); 398 -SkIntToScalar(mask.fBounds.fTop));
426 matrix.postScale(SkIntToScalar(4), SK_Scalar1); 399 matrix.postScale(SkIntToScalar(4), SK_Scalar1);
427 dstRB = 0; // signals we need a copy 400 dstRB = 0; // signals we need a copy
428 break; 401 break;
429 default: 402 default:
430 SkDEBUGFAIL("unexpected mask format"); 403 SkDEBUGFAIL("unexpected mask format");
431 } 404 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 applyLUTToA8Mask(mask, maskPreBlend.fG); 436 applyLUTToA8Mask(mask, maskPreBlend.fG);
464 } 437 }
465 break; 438 break;
466 case SkMask::kLCD16_Format: 439 case SkMask::kLCD16_Format:
467 if (maskPreBlend.isApplicable()) { 440 if (maskPreBlend.isApplicable()) {
468 pack4xHToLCD16<true>(bm, mask, maskPreBlend); 441 pack4xHToLCD16<true>(bm, mask, maskPreBlend);
469 } else { 442 } else {
470 pack4xHToLCD16<false>(bm, mask, maskPreBlend); 443 pack4xHToLCD16<false>(bm, mask, maskPreBlend);
471 } 444 }
472 break; 445 break;
473 case SkMask::kLCD32_Format:
474 if (maskPreBlend.isApplicable()) {
475 pack4xHToLCD32<true>(bm, mask, maskPreBlend);
476 } else {
477 pack4xHToLCD32<false>(bm, mask, maskPreBlend);
478 }
479 break;
480 default: 446 default:
481 break; 447 break;
482 } 448 }
483 } 449 }
484 450
485 static void extract_alpha(const SkMask& dst, 451 static void extract_alpha(const SkMask& dst,
486 const SkPMColor* srcRow, size_t srcRB) { 452 const SkPMColor* srcRow, size_t srcRB) {
487 int width = dst.fBounds.width(); 453 int width = dst.fBounds.width();
488 int height = dst.fBounds.height(); 454 int height = dst.fBounds.height();
489 int dstRB = dst.fRowBytes; 455 int dstRB = dst.fRowBytes;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 758 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
793 bool allowFailure) const { 759 bool allowFailure) const {
794 SkScalerContext* c = this->onCreateScalerContext(desc); 760 SkScalerContext* c = this->onCreateScalerContext(desc);
795 761
796 if (!c && !allowFailure) { 762 if (!c && !allowFailure) {
797 c = SkNEW_ARGS(SkScalerContext_Empty, 763 c = SkNEW_ARGS(SkScalerContext_Empty,
798 (const_cast<SkTypeface*>(this), desc)); 764 (const_cast<SkTypeface*>(this), desc));
799 } 765 }
800 return c; 766 return c;
801 } 767 }
OLDNEW
« no previous file with comments | « src/core/SkScalerContext.h ('k') | src/gpu/GrBitmapTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698