| 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 "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 resource()->size.height(), | 490 resource()->size.height(), |
| 491 stride); | 491 stride); |
| 492 raster_bitmap_.setPixels(mapped_buffer_); | 492 raster_bitmap_.setPixels(mapped_buffer_); |
| 493 break; | 493 break; |
| 494 case LUMINANCE_8: | 494 case LUMINANCE_8: |
| 495 case RGB_565: | 495 case RGB_565: |
| 496 case ETC1: | 496 case ETC1: |
| 497 NOTREACHED(); | 497 NOTREACHED(); |
| 498 break; | 498 break; |
| 499 } | 499 } |
| 500 skia::RefPtr<SkBitmapDevice> device = | 500 raster_canvas_ = skia::AdoptRef(new SkCanvas(raster_bitmap_)); |
| 501 skia::AdoptRef(new SkBitmapDevice(raster_bitmap_)); | |
| 502 raster_canvas_ = skia::AdoptRef(new SkCanvas(device.get())); | |
| 503 raster_bitmap_generation_id_ = raster_bitmap_.getGenerationID(); | 501 raster_bitmap_generation_id_ = raster_bitmap_.getGenerationID(); |
| 504 return raster_canvas_.get(); | 502 return raster_canvas_.get(); |
| 505 } | 503 } |
| 506 | 504 |
| 507 bool ResourceProvider::BitmapRasterBuffer::DoUnlockForWrite() { | 505 bool ResourceProvider::BitmapRasterBuffer::DoUnlockForWrite() { |
| 508 raster_canvas_.clear(); | 506 raster_canvas_.clear(); |
| 509 | 507 |
| 510 // getGenerationID returns a non-zero, unique value corresponding to the | 508 // getGenerationID returns a non-zero, unique value corresponding to the |
| 511 // pixels in bitmap. Hence, a change since DoLockForWrite was called means the | 509 // pixels in bitmap. Hence, a change since DoLockForWrite was called means the |
| 512 // bitmap has changed. | 510 // bitmap has changed. |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 ContextProvider* context_provider = output_surface_->context_provider(); | 2179 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2182 return context_provider ? context_provider->ContextGL() : NULL; | 2180 return context_provider ? context_provider->ContextGL() : NULL; |
| 2183 } | 2181 } |
| 2184 | 2182 |
| 2185 class GrContext* ResourceProvider::GrContext() const { | 2183 class GrContext* ResourceProvider::GrContext() const { |
| 2186 ContextProvider* context_provider = output_surface_->context_provider(); | 2184 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2187 return context_provider ? context_provider->GrContext() : NULL; | 2185 return context_provider ? context_provider->GrContext() : NULL; |
| 2188 } | 2186 } |
| 2189 | 2187 |
| 2190 } // namespace cc | 2188 } // namespace cc |
| OLD | NEW |