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

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

Issue 173893002: use colortype instead of config (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | src/core/SkSpriteBlitter_ARGB32.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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 dst += rowBytes; 422 dst += rowBytes;
423 } 423 }
424 } 424 }
425 425
426 template<bool APPLY_PREBLEND> 426 template<bool APPLY_PREBLEND>
427 static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst, 427 static void pack4xHToLCD16(const SkBitmap& src, const SkMask& dst,
428 const SkMaskGamma::PreBlend& maskPreBlend) { 428 const SkMaskGamma::PreBlend& maskPreBlend) {
429 #define SAMPLES_PER_PIXEL 4 429 #define SAMPLES_PER_PIXEL 4
430 #define LCD_PER_PIXEL 3 430 #define LCD_PER_PIXEL 3
431 SkASSERT(SkBitmap::kA8_Config == src.config()); 431 SkASSERT(kAlpha_8_SkColorType == src.colorType());
432 SkASSERT(SkMask::kLCD16_Format == dst.fFormat); 432 SkASSERT(SkMask::kLCD16_Format == dst.fFormat);
433 433
434 const int sample_width = src.width(); 434 const int sample_width = src.width();
435 const int height = src.height(); 435 const int height = src.height();
436 436
437 uint16_t* dstP = (uint16_t*)dst.fImage; 437 uint16_t* dstP = (uint16_t*)dst.fImage;
438 size_t dstRB = dst.fRowBytes; 438 size_t dstRB = dst.fRowBytes;
439 // An N tap FIR is defined by 439 // An N tap FIR is defined by
440 // out[n] = coeff[0]*x[n] + coeff[1]*x[n-1] + ... + coeff[N]*x[n-N] 440 // out[n] = coeff[0]*x[n] + coeff[1]*x[n-1] + ... + coeff[N]*x[n-N]
441 // or 441 // or
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 #endif 495 #endif
496 dstP[pixel_x] = SkPack888ToRGB16(r, g, b); 496 dstP[pixel_x] = SkPack888ToRGB16(r, g, b);
497 } 497 }
498 dstP = (uint16_t*)((char*)dstP + dstRB); 498 dstP = (uint16_t*)((char*)dstP + dstRB);
499 } 499 }
500 } 500 }
501 501
502 template<bool APPLY_PREBLEND> 502 template<bool APPLY_PREBLEND>
503 static void pack4xHToLCD32(const SkBitmap& src, const SkMask& dst, 503 static void pack4xHToLCD32(const SkBitmap& src, const SkMask& dst,
504 const SkMaskGamma::PreBlend& maskPreBlend) { 504 const SkMaskGamma::PreBlend& maskPreBlend) {
505 SkASSERT(SkBitmap::kA8_Config == src.config()); 505 SkASSERT(kAlpha_8_SkColorType == src.colorType());
506 SkASSERT(SkMask::kLCD32_Format == dst.fFormat); 506 SkASSERT(SkMask::kLCD32_Format == dst.fFormat);
507 507
508 const int width = dst.fBounds.width(); 508 const int width = dst.fBounds.width();
509 const int height = dst.fBounds.height(); 509 const int height = dst.fBounds.height();
510 SkPMColor* dstP = (SkPMColor*)dst.fImage; 510 SkPMColor* dstP = (SkPMColor*)dst.fImage;
511 size_t dstRB = dst.fRowBytes; 511 size_t dstRB = dst.fRowBytes;
512 512
513 for (int y = 0; y < height; ++y) { 513 for (int y = 0; y < height; ++y) {
514 const uint8_t* srcP = src.getAddr8(0, y); 514 const uint8_t* srcP = src.getAddr8(0, y);
515 515
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc, 981 SkScalerContext* SkTypeface::createScalerContext(const SkDescriptor* desc,
982 bool allowFailure) const { 982 bool allowFailure) const {
983 SkScalerContext* c = this->onCreateScalerContext(desc); 983 SkScalerContext* c = this->onCreateScalerContext(desc);
984 984
985 if (!c && !allowFailure) { 985 if (!c && !allowFailure) {
986 c = SkNEW_ARGS(SkScalerContext_Empty, 986 c = SkNEW_ARGS(SkScalerContext_Empty,
987 (const_cast<SkTypeface*>(this), desc)); 987 (const_cast<SkTypeface*>(this), desc));
988 } 988 }
989 return c; 989 return c;
990 } 990 }
OLDNEW
« no previous file with comments | « src/core/SkScaledImageCache.cpp ('k') | src/core/SkSpriteBlitter_ARGB32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698