| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 #include "SkGr.h" | 9 #include "SkGr.h" |
| 10 #include "SkGrPriv.h" | 10 #include "SkGrPriv.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 } else { | 256 } else { |
| 257 SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap
.height()); | 257 SkImageInfo info = SkImageInfo::MakeN32Premul(pixmap.width(), pixmap
.height()); |
| 258 tmpBitmap.allocPixels(info); | 258 tmpBitmap.allocPixels(info); |
| 259 if (!pixmap.readPixels(info, tmpBitmap.getPixels(), tmpBitmap.rowByt
es())) { | 259 if (!pixmap.readPixels(info, tmpBitmap.getPixels(), tmpBitmap.rowByt
es())) { |
| 260 return nullptr; | 260 return nullptr; |
| 261 } | 261 } |
| 262 if (!tmpBitmap.peekPixels(&tmpPixmap)) { | 262 if (!tmpBitmap.peekPixels(&tmpPixmap)) { |
| 263 return nullptr; | 263 return nullptr; |
| 264 } | 264 } |
| 265 pmap = &tmpPixmap; | 265 pmap = &tmpPixmap; |
| 266 // must rebuild desc, since we've forced the info to be N32 |
| 267 desc = GrImageInfoToSurfaceDesc(pmap->info()); |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 | 270 |
| 269 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, pmap->a
ddr(), | 271 return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, pmap->a
ddr(), |
| 270 pmap->rowBytes()); | 272 pmap->rowBytes()); |
| 271 } | 273 } |
| 272 | 274 |
| 273 | 275 |
| 274 //////////////////////////////////////////////////////////////////////////////// | 276 //////////////////////////////////////////////////////////////////////////////// |
| 275 | 277 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 SkErrorInternals::SetError( kInvalidPaint_SkError, | 696 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 695 "Sorry, I don't understand the filtering
" | 697 "Sorry, I don't understand the filtering
" |
| 696 "mode you asked for. Falling back to " | 698 "mode you asked for. Falling back to " |
| 697 "MIPMaps."); | 699 "MIPMaps."); |
| 698 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 700 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 699 break; | 701 break; |
| 700 | 702 |
| 701 } | 703 } |
| 702 return textureFilterMode; | 704 return textureFilterMode; |
| 703 } | 705 } |
| OLD | NEW |