| OLD | NEW | 
|---|
| 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 "SkCoreBlitters.h" | 10 #include "SkCoreBlitters.h" | 
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343         } | 343         } | 
| 344 | 344 | 
| 345         y += 1; | 345         y += 1; | 
| 346         device += fDevice.rowBytes(); | 346         device += fDevice.rowBytes(); | 
| 347         alpha += mask.fRowBytes; | 347         alpha += mask.fRowBytes; | 
| 348     } | 348     } | 
| 349 } | 349 } | 
| 350 | 350 | 
| 351 /////////////////////////////////////////////////////////////////////////////// | 351 /////////////////////////////////////////////////////////////////////////////// | 
| 352 | 352 | 
| 353 #define SK_A8_COVERAGE_BLIT_SKIP_ZEROS |  | 
| 354 |  | 
| 355 SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkBitmap& device, | 353 SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkBitmap& device, | 
| 356                              const SkPaint& paint) : SkRasterBlitter(device) { | 354                              const SkPaint& paint) : SkRasterBlitter(device) { | 
| 357     SkASSERT(NULL == paint.getShader()); | 355     SkASSERT(NULL == paint.getShader()); | 
| 358     SkASSERT(NULL == paint.getXfermode()); | 356     SkASSERT(NULL == paint.getXfermode()); | 
| 359     SkASSERT(NULL == paint.getColorFilter()); | 357     SkASSERT(NULL == paint.getColorFilter()); | 
| 360 } | 358 } | 
| 361 | 359 | 
| 362 void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 360 void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 
| 363                                       const int16_t runs[]) { | 361                                       const int16_t runs[]) { | 
| 364     SkASSERT(0 == x); |  | 
| 365 |  | 
| 366     uint8_t* device = fDevice.getAddr8(x, y); | 362     uint8_t* device = fDevice.getAddr8(x, y); | 
| 367     SkDEBUGCODE(int totalCount = 0;) | 363     SkDEBUGCODE(int totalCount = 0;) | 
| 368 | 364 | 
| 369     for (;;) { | 365     for (;;) { | 
| 370         int count = runs[0]; | 366         int count = runs[0]; | 
| 371         SkASSERT(count >= 0); | 367         SkASSERT(count >= 0); | 
| 372         if (count == 0) { | 368         if (count == 0) { | 
| 373             return; | 369             return; | 
| 374         } | 370         } | 
| 375 #ifdef SK_A8_COVERAGE_BLIT_SKIP_ZEROS | 371         if (antialias[0]) { | 
| 376         if (antialias[0]) |  | 
| 377 #endif |  | 
| 378         { |  | 
| 379             memset(device, antialias[0], count); | 372             memset(device, antialias[0], count); | 
| 380         } | 373         } | 
| 381         runs += count; | 374         runs += count; | 
| 382         antialias += count; | 375         antialias += count; | 
| 383         device += count; | 376         device += count; | 
| 384 | 377 | 
| 385         SkDEBUGCODE(totalCount += count;) | 378         SkDEBUGCODE(totalCount += count;) | 
| 386     } | 379     } | 
| 387     SkASSERT(fDevice.width() == totalCount); | 380     SkASSERT(fDevice.width() == totalCount); | 
| 388 } | 381 } | 
| 389 | 382 | 
| 390 void SkA8_Coverage_Blitter::blitH(int x, int y, int width) { | 383 void SkA8_Coverage_Blitter::blitH(int x, int y, int width) { | 
| 391     memset(fDevice.getAddr8(x, y), 0xFF, width); | 384     memset(fDevice.getAddr8(x, y), 0xFF, width); | 
| 392 } | 385 } | 
| 393 | 386 | 
| 394 void SkA8_Coverage_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { | 387 void SkA8_Coverage_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { | 
| 395 #ifdef SK_A8_COVERAGE_BLIT_SKIP_ZEROS |  | 
| 396     if (0 == alpha) { | 388     if (0 == alpha) { | 
| 397         return; | 389         return; | 
| 398     } | 390     } | 
| 399 #endif | 391 | 
| 400     uint8_t* dst = fDevice.getAddr8(x, y); | 392     uint8_t* dst = fDevice.getAddr8(x, y); | 
| 401     const size_t dstRB = fDevice.rowBytes(); | 393     const size_t dstRB = fDevice.rowBytes(); | 
| 402     while (--height >= 0) { | 394     while (--height >= 0) { | 
| 403         *dst = alpha; | 395         *dst = alpha; | 
| 404         dst += dstRB; | 396         dst += dstRB; | 
| 405     } | 397     } | 
| 406 } | 398 } | 
| 407 | 399 | 
| 408 void SkA8_Coverage_Blitter::blitRect(int x, int y, int width, int height) { | 400 void SkA8_Coverage_Blitter::blitRect(int x, int y, int width, int height) { | 
| 409     uint8_t* dst = fDevice.getAddr8(x, y); | 401     uint8_t* dst = fDevice.getAddr8(x, y); | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 430     while (--height >= 0) { | 422     while (--height >= 0) { | 
| 431         memcpy(dst, src, width); | 423         memcpy(dst, src, width); | 
| 432         dst += dstRB; | 424         dst += dstRB; | 
| 433         src += srcRB; | 425         src += srcRB; | 
| 434     } | 426     } | 
| 435 } | 427 } | 
| 436 | 428 | 
| 437 const SkBitmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) { | 429 const SkBitmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) { | 
| 438     return NULL; | 430     return NULL; | 
| 439 } | 431 } | 
| OLD | NEW | 
|---|