OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 | 10 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 bool GrContext::writeSurfacePixels(GrSurface* surface, | 319 bool GrContext::writeSurfacePixels(GrSurface* surface, |
320 int left, int top, int width, int height, | 320 int left, int top, int width, int height, |
321 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, | 321 GrPixelConfig srcConfig, const void* buffer,
size_t rowBytes, |
322 uint32_t pixelOpsFlags) { | 322 uint32_t pixelOpsFlags) { |
323 RETURN_FALSE_IF_ABANDONED | 323 RETURN_FALSE_IF_ABANDONED |
324 { | 324 { |
325 GrTexture* texture = NULL; | 325 GrTexture* texture = NULL; |
326 if (!(kUnpremul_PixelOpsFlag & pixelOpsFlags) && (texture = surface->asT
exture()) && | 326 if (!(kUnpremul_PixelOpsFlag & pixelOpsFlags) && (texture = surface->asT
exture()) && |
327 fGpu->canWriteTexturePixels(texture, srcConfig) && | 327 fGpu->canWriteTexturePixels(texture, srcConfig)) { |
328 (!fCaps->useDrawInsteadOfPartialTextureWrite() || | |
329 (width == texture->width() && height == texture->height()))) { | |
330 | 328 |
331 if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) && | 329 if (!(kDontFlush_PixelOpsFlag & pixelOpsFlags) && |
332 surface->surfacePriv().hasPendingIO()) { | 330 surface->surfacePriv().hasPendingIO()) { |
333 this->flush(); | 331 this->flush(); |
334 } | 332 } |
335 return fGpu->writeTexturePixels(texture, left, top, width, height, | 333 return fGpu->writeTexturePixels(texture, left, top, width, height, |
336 srcConfig, buffer, rowBytes); | 334 srcConfig, buffer, rowBytes); |
337 // Don't need to check kFlushWrites_PixelOp here, we just did a dire
ct write so the | 335 // Don't need to check kFlushWrites_PixelOp here, we just did a dire
ct write so the |
338 // upload is already flushed. | 336 // upload is already flushed. |
339 } | 337 } |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 ////////////////////////////////////////////////////////////////////////////// | 745 ////////////////////////////////////////////////////////////////////////////// |
748 | 746 |
749 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { | 747 void GrContext::addGpuTraceMarker(const GrGpuTraceMarker* marker) { |
750 fGpu->addGpuTraceMarker(marker); | 748 fGpu->addGpuTraceMarker(marker); |
751 } | 749 } |
752 | 750 |
753 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 751 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
754 fGpu->removeGpuTraceMarker(marker); | 752 fGpu->removeGpuTraceMarker(marker); |
755 } | 753 } |
756 | 754 |
OLD | NEW |