OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/resource_provider.h" | 7 #include "cc/resource_provider.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 context3d->bindTexture(GL_TEXTURE_2D, resource->glId); | 277 context3d->bindTexture(GL_TEXTURE_2D, resource->glId); |
278 m_textureUploader->upload(image, | 278 m_textureUploader->upload(image, |
279 imageRect, | 279 imageRect, |
280 sourceRect, | 280 sourceRect, |
281 destOffset, | 281 destOffset, |
282 resource->format, | 282 resource->format, |
283 resource->size); | 283 resource->size); |
284 } | 284 } |
285 | 285 |
286 if (resource->pixels) { | 286 if (resource->pixels) { |
| 287 DCHECK(resource->format == GL_RGBA); |
287 SkBitmap srcFull; | 288 SkBitmap srcFull; |
288 srcFull.setConfig(SkBitmap::kARGB_8888_Config, imageRect.width(), imageR
ect.height()); | 289 srcFull.setConfig(SkBitmap::kARGB_8888_Config, imageRect.width(), imageR
ect.height()); |
289 srcFull.setPixels(const_cast<uint8_t*>(image)); | 290 srcFull.setPixels(const_cast<uint8_t*>(image)); |
290 SkBitmap srcSubset; | 291 SkBitmap srcSubset; |
291 SkIRect skSourceRect = SkIRect::MakeXYWH(sourceRect.x(), sourceRect.y(),
sourceRect.width(), sourceRect.height()); | 292 SkIRect skSourceRect = SkIRect::MakeXYWH(sourceRect.x(), sourceRect.y(),
sourceRect.width(), sourceRect.height()); |
292 skSourceRect.offset(-imageRect.x(), -imageRect.y()); | 293 skSourceRect.offset(-imageRect.x(), -imageRect.y()); |
293 srcFull.extractSubset(&srcSubset, skSourceRect); | 294 srcFull.extractSubset(&srcSubset, skSourceRect); |
294 | 295 |
295 ScopedWriteLockSoftware lock(this, id); | 296 ScopedWriteLockSoftware lock(this, id); |
296 SkCanvas* dest = lock.skCanvas(); | 297 SkCanvas* dest = lock.skCanvas(); |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 g_debugZone = zone; | 709 g_debugZone = zone; |
709 } | 710 } |
710 | 711 |
711 void ResourceProvider::debugNotifyLeaveZone() | 712 void ResourceProvider::debugNotifyLeaveZone() |
712 { | 713 { |
713 g_debugZone = 0; | 714 g_debugZone = 0; |
714 } | 715 } |
715 | 716 |
716 | 717 |
717 } // namespace cc | 718 } // namespace cc |
OLD | NEW |