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

Side by Side Diff: trunk/src/cc/resources/resource_provider.cc

Issue 183003011: Revert 254567 "don't create SkDevice directly, use SkBitmap or (..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 months 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 | Annotate | Revision Log
OLDNEW
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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 resource()->size.height(), 488 resource()->size.height(),
489 stride); 489 stride);
490 raster_bitmap_.setPixels(mapped_buffer_); 490 raster_bitmap_.setPixels(mapped_buffer_);
491 break; 491 break;
492 case LUMINANCE_8: 492 case LUMINANCE_8:
493 case RGB_565: 493 case RGB_565:
494 case ETC1: 494 case ETC1:
495 NOTREACHED(); 495 NOTREACHED();
496 break; 496 break;
497 } 497 }
498 raster_canvas_ = skia::AdoptRef(new SkCanvas(raster_bitmap_)); 498 skia::RefPtr<SkBitmapDevice> device =
499 skia::AdoptRef(new SkBitmapDevice(raster_bitmap_));
500 raster_canvas_ = skia::AdoptRef(new SkCanvas(device.get()));
499 raster_bitmap_generation_id_ = raster_bitmap_.getGenerationID(); 501 raster_bitmap_generation_id_ = raster_bitmap_.getGenerationID();
500 return raster_canvas_.get(); 502 return raster_canvas_.get();
501 } 503 }
502 504
503 bool ResourceProvider::BitmapRasterBuffer::DoUnlockForWrite() { 505 bool ResourceProvider::BitmapRasterBuffer::DoUnlockForWrite() {
504 raster_canvas_.clear(); 506 raster_canvas_.clear();
505 507
506 // getGenerationID returns a non-zero, unique value corresponding to the 508 // getGenerationID returns a non-zero, unique value corresponding to the
507 // 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
508 // bitmap has changed. 510 // bitmap has changed.
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 ContextProvider* context_provider = output_surface_->context_provider(); 2180 ContextProvider* context_provider = output_surface_->context_provider();
2179 return context_provider ? context_provider->ContextGL() : NULL; 2181 return context_provider ? context_provider->ContextGL() : NULL;
2180 } 2182 }
2181 2183
2182 class GrContext* ResourceProvider::GrContext() const { 2184 class GrContext* ResourceProvider::GrContext() const {
2183 ContextProvider* context_provider = output_surface_->context_provider(); 2185 ContextProvider* context_provider = output_surface_->context_provider();
2184 return context_provider ? context_provider->GrContext() : NULL; 2186 return context_provider ? context_provider->GrContext() : NULL;
2185 } 2187 }
2186 2188
2187 } // namespace cc 2189 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/output/gl_renderer.cc ('k') | trunk/src/chrome/browser/extensions/extension_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698