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

Side by Side Diff: src/image/SkImage.cpp

Issue 2461773002: add isAlphaOnly() query (Closed)
Patch Set: add test Created 4 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
OLDNEW
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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapCache.h" 9 #include "SkBitmapCache.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 offset->fX += outSubset->x(); 364 offset->fX += outSubset->x();
365 offset->fY += outSubset->y(); 365 offset->fY += outSubset->y();
366 // This isn't really a "tight" subset, but includes any texture padding. 366 // This isn't really a "tight" subset, but includes any texture padding.
367 return result->makeTightSubset(fullSize); 367 return result->makeTightSubset(fullSize);
368 } 368 }
369 369
370 bool SkImage::isLazyGenerated() const { 370 bool SkImage::isLazyGenerated() const {
371 return as_IB(this)->onIsLazyGenerated(); 371 return as_IB(this)->onIsLazyGenerated();
372 } 372 }
373 373
374 bool SkImage::isAlphaOnly() const {
375 return as_IB(this)->onImageInfo().colorType() == kAlpha_8_SkColorType;
376 }
377
374 //////////////////////////////////////////////////////////////////////////////// ////// 378 //////////////////////////////////////////////////////////////////////////////// //////
375 379
376 #if !SK_SUPPORT_GPU 380 #if !SK_SUPPORT_GPU
377 381
378 sk_sp<SkImage> SkImage::MakeTextureFromPixmap(GrContext*, const SkPixmap&, SkBud geted budgeted) { 382 sk_sp<SkImage> SkImage::MakeTextureFromPixmap(GrContext*, const SkPixmap&, SkBud geted budgeted) {
379 return nullptr; 383 return nullptr;
380 } 384 }
381 385
382 sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, const GrMip Level* texels, 386 sk_sp<SkImage> MakeTextureFromMipMap(GrContext*, const SkImageInfo&, const GrMip Level* texels,
383 int mipLevelCount, SkBudgeted, SkSourceGamm aTreatment) { 387 int mipLevelCount, SkBudgeted, SkSourceGamm aTreatment) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 SkASSERT(image); 512 SkASSERT(image);
509 SkASSERT(ctx); 513 SkASSERT(ctx);
510 as_IB(image)->onPinAsTexture(ctx); 514 as_IB(image)->onPinAsTexture(ctx);
511 } 515 }
512 516
513 void SkImage_unpinAsTexture(const SkImage* image, GrContext* ctx) { 517 void SkImage_unpinAsTexture(const SkImage* image, GrContext* ctx) {
514 SkASSERT(image); 518 SkASSERT(image);
515 SkASSERT(ctx); 519 SkASSERT(ctx);
516 as_IB(image)->onUnpinAsTexture(ctx); 520 as_IB(image)->onUnpinAsTexture(ctx);
517 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698