| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 context3d->bindTexture(GL_TEXTURE_2D, resource->glId); | 283 context3d->bindTexture(GL_TEXTURE_2D, resource->glId); |
| 284 m_textureUploader->upload(image, | 284 m_textureUploader->upload(image, |
| 285 imageRect, | 285 imageRect, |
| 286 sourceRect, | 286 sourceRect, |
| 287 destOffset, | 287 destOffset, |
| 288 resource->format, | 288 resource->format, |
| 289 resource->size); | 289 resource->size); |
| 290 } | 290 } |
| 291 | 291 |
| 292 if (resource->pixels) { | 292 if (resource->pixels) { |
| 293 DCHECK(resource->format == GL_RGBA); |
| 293 SkBitmap srcFull; | 294 SkBitmap srcFull; |
| 294 srcFull.setConfig(SkBitmap::kARGB_8888_Config, imageRect.width(), imageR
ect.height()); | 295 srcFull.setConfig(SkBitmap::kARGB_8888_Config, imageRect.width(), imageR
ect.height()); |
| 295 srcFull.setPixels(const_cast<uint8_t*>(image)); | 296 srcFull.setPixels(const_cast<uint8_t*>(image)); |
| 296 SkBitmap srcSubset; | 297 SkBitmap srcSubset; |
| 297 SkIRect skSourceRect = SkIRect::MakeXYWH(sourceRect.x(), sourceRect.y(),
sourceRect.width(), sourceRect.height()); | 298 SkIRect skSourceRect = SkIRect::MakeXYWH(sourceRect.x(), sourceRect.y(),
sourceRect.width(), sourceRect.height()); |
| 298 skSourceRect.offset(-imageRect.x(), -imageRect.y()); | 299 skSourceRect.offset(-imageRect.x(), -imageRect.y()); |
| 299 srcFull.extractSubset(&srcSubset, skSourceRect); | 300 srcFull.extractSubset(&srcSubset, skSourceRect); |
| 300 | 301 |
| 301 ScopedWriteLockSoftware lock(this, id); | 302 ScopedWriteLockSoftware lock(this, id); |
| 302 SkCanvas* dest = lock.skCanvas(); | 303 SkCanvas* dest = lock.skCanvas(); |
| (...skipping 405 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 } | 718 } |
| OLD | NEW |