| 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 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1942 NULL); | 1942 NULL); |
| 1943 } | 1943 } |
| 1944 gl->EndQueryEXT(GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM); | 1944 gl->EndQueryEXT(GL_ASYNC_PIXEL_UNPACK_COMPLETED_CHROMIUM); |
| 1945 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); | 1945 gl->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| 1946 } else { | 1946 } else { |
| 1947 DCHECK_EQ(Bitmap, resource->type); | 1947 DCHECK_EQ(Bitmap, resource->type); |
| 1948 DCHECK(!resource->mailbox.IsValid()); | 1948 DCHECK(!resource->mailbox.IsValid()); |
| 1949 DCHECK(resource->pixel_buffer); | 1949 DCHECK(resource->pixel_buffer); |
| 1950 DCHECK_EQ(RGBA_8888, resource->format); | 1950 DCHECK_EQ(RGBA_8888, resource->format); |
| 1951 | 1951 |
| 1952 std::swap(resource->pixels, resource->pixel_buffer); | 1952 memcpy( |
| 1953 resource->pixels, resource->pixel_buffer, 4 * resource->size.GetArea()); |
| 1953 delete[] resource->pixel_buffer; | 1954 delete[] resource->pixel_buffer; |
| 1954 resource->pixel_buffer = NULL; | 1955 resource->pixel_buffer = NULL; |
| 1955 } | 1956 } |
| 1956 | 1957 |
| 1957 resource->pending_set_pixels = true; | 1958 resource->pending_set_pixels = true; |
| 1958 resource->set_pixels_completion_forced = false; | 1959 resource->set_pixels_completion_forced = false; |
| 1959 } | 1960 } |
| 1960 | 1961 |
| 1961 void ResourceProvider::ForceSetPixelsToComplete(ResourceId id) { | 1962 void ResourceProvider::ForceSetPixelsToComplete(ResourceId id) { |
| 1962 Resource* resource = GetResource(id); | 1963 Resource* resource = GetResource(id); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2180 ContextProvider* context_provider = output_surface_->context_provider(); | 2181 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2181 return context_provider ? context_provider->ContextGL() : NULL; | 2182 return context_provider ? context_provider->ContextGL() : NULL; |
| 2182 } | 2183 } |
| 2183 | 2184 |
| 2184 class GrContext* ResourceProvider::GrContext() const { | 2185 class GrContext* ResourceProvider::GrContext() const { |
| 2185 ContextProvider* context_provider = output_surface_->context_provider(); | 2186 ContextProvider* context_provider = output_surface_->context_provider(); |
| 2186 return context_provider ? context_provider->GrContext() : NULL; | 2187 return context_provider ? context_provider->GrContext() : NULL; |
| 2187 } | 2188 } |
| 2188 | 2189 |
| 2189 } // namespace cc | 2190 } // namespace cc |
| OLD | NEW |