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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 609863002: Don't flush on copyTexture, take 2 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 if (NULL == target) { 1567 if (NULL == target) {
1568 return; 1568 return;
1569 } 1569 }
1570 target->discard(renderTarget); 1570 target->discard(renderTarget);
1571 } 1571 }
1572 1572
1573 void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* topLeft) { 1573 void GrContext::copyTexture(GrTexture* src, GrRenderTarget* dst, const SkIPoint* topLeft) {
1574 if (NULL == src || NULL == dst) { 1574 if (NULL == src || NULL == dst) {
1575 return; 1575 return;
1576 } 1576 }
1577
1577 ASSERT_OWNED_RESOURCE(src); 1578 ASSERT_OWNED_RESOURCE(src);
1579 ASSERT_OWNED_RESOURCE(dst);
1578 1580
1581 GrDrawTarget* target = this->prepareToDraw(NULL, kYes_BufferedDraw, NULL, NU LL);
1582 GrDrawTarget::AutoStateRestore asr(target, GrDrawTarget::kReset_ASRInit);
1583 GrDrawState* drawState = target->drawState();
1579 1584
1580 if (src->hasPendingWrite() || dst->hasPendingIO()) { 1585 drawState->disableState(GrDrawState::kClip_StateBit);
1581 this->flush(); 1586 drawState->setRenderTarget(dst);
1582 }
1583 1587
1584 GrDrawTarget::AutoStateRestore asr(fGpu, GrDrawTarget::kReset_ASRInit);
1585 GrDrawState* drawState = fGpu->drawState();
1586 drawState->setRenderTarget(dst);
1587 SkMatrix sampleM; 1588 SkMatrix sampleM;
1588 sampleM.setIDiv(src->width(), src->height()); 1589 sampleM.setIDiv(src->width(), src->height());
1589 SkIRect srcRect = SkIRect::MakeWH(dst->width(), dst->height()); 1590 SkIRect srcRect = SkIRect::MakeWH(dst->width(), dst->height());
1590 if (topLeft) { 1591 if (topLeft) {
1591 srcRect.offset(*topLeft); 1592 srcRect.offset(*topLeft);
1592 } 1593 }
1593 SkIRect srcBounds = SkIRect::MakeWH(src->width(), src->height()); 1594 SkIRect srcBounds = SkIRect::MakeWH(src->width(), src->height());
1594 if (!srcRect.intersect(srcBounds)) { 1595 if (!srcRect.intersect(srcBounds)) {
1595 return; 1596 return;
1596 } 1597 }
1597 sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTo p)); 1598 sampleM.preTranslate(SkIntToScalar(srcRect.fLeft), SkIntToScalar(srcRect.fTo p));
1598 drawState->addColorTextureProcessor(src, sampleM); 1599 drawState->addColorTextureProcessor(src, sampleM);
1600
1599 SkRect dstR = SkRect::MakeWH(SkIntToScalar(srcRect.width()), SkIntToScalar(s rcRect.height())); 1601 SkRect dstR = SkRect::MakeWH(SkIntToScalar(srcRect.width()), SkIntToScalar(s rcRect.height()));
1600 fGpu->drawSimpleRect(dstR); 1602 target->drawSimpleRect(dstR);
1601 } 1603 }
1602 1604
1603 bool GrContext::writeRenderTargetPixels(GrRenderTarget* target, 1605 bool GrContext::writeRenderTargetPixels(GrRenderTarget* target,
1604 int left, int top, int width, int height , 1606 int left, int top, int width, int height ,
1605 GrPixelConfig srcConfig, 1607 GrPixelConfig srcConfig,
1606 const void* buffer, 1608 const void* buffer,
1607 size_t rowBytes, 1609 size_t rowBytes,
1608 uint32_t flags) { 1610 uint32_t flags) {
1609 ASSERT_OWNED_RESOURCE(target); 1611 ASSERT_OWNED_RESOURCE(target);
1610 1612
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 fResourceCache->printStats(); 1946 fResourceCache->printStats();
1945 } 1947 }
1946 #endif 1948 #endif
1947 1949
1948 #if GR_GPU_STATS 1950 #if GR_GPU_STATS
1949 const GrContext::GPUStats* GrContext::gpuStats() const { 1951 const GrContext::GPUStats* GrContext::gpuStats() const {
1950 return fGpu->gpuStats(); 1952 return fGpu->gpuStats();
1951 } 1953 }
1952 #endif 1954 #endif
1953 1955
OLDNEW
« no previous file with comments | « no previous file | src/gpu/SkGrPixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698