OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include <new> | 7 #include <new> |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
10 #include "SkPicturePlayback.h" | 10 #include "SkPicturePlayback.h" |
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 922 |
923 if (NULL != fReplacements) { | 923 if (NULL != fReplacements) { |
924 // Potentially replace a block of operations with a single drawBitma
p call | 924 // Potentially replace a block of operations with a single drawBitma
p call |
925 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp = | 925 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp = |
926 fReplacements->lookupByStart(reader.
offset()); | 926 fReplacements->lookupByStart(reader.
offset()); |
927 if (NULL != temp) { | 927 if (NULL != temp) { |
928 SkASSERT(NULL != temp->fBM); | 928 SkASSERT(NULL != temp->fBM); |
929 SkASSERT(NULL != temp->fPaint); | 929 SkASSERT(NULL != temp->fPaint); |
930 canvas.save(); | 930 canvas.save(); |
931 canvas.setMatrix(initialMatrix); | 931 canvas.setMatrix(initialMatrix); |
932 canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp
->fPaint); | 932 SkRect src = SkRect::Make(temp->fSrcRect); |
| 933 SkRect dst = SkRect::MakeXYWH(temp->fPos.fX, temp->fPos.fY, |
| 934 temp->fSrcRect.width(), |
| 935 temp->fSrcRect.height()); |
| 936 canvas.drawBitmapRectToRect(*temp->fBM, &src, dst, temp->fPaint)
; |
933 canvas.restore(); | 937 canvas.restore(); |
934 | 938 |
935 if (it.isValid()) { | 939 if (it.isValid()) { |
936 // This save is needed since the BBH will automatically issu
e | 940 // This save is needed since the BBH will automatically issu
e |
937 // a restore to balanced the saveLayer we're skipping | 941 // a restore to balanced the saveLayer we're skipping |
938 canvas.save(); | 942 canvas.save(); |
939 | 943 |
940 // At this point we know that the PictureStateTree was aimin
g | 944 // At this point we know that the PictureStateTree was aimin
g |
941 // for some draw op within temp's saveLayer (although potent
ially | 945 // for some draw op within temp's saveLayer (although potent
ially |
942 // in a separate saveLayer nested inside it). | 946 // in a separate saveLayer nested inside it). |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1917 for (index = 0; index < fPictureCount; index++) | 1921 for (index = 0; index < fPictureCount; index++) |
1918 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1922 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1919 "picture%p, ", fPictureRefs[index]); | 1923 "picture%p, ", fPictureRefs[index]); |
1920 if (fPictureCount > 0) | 1924 if (fPictureCount > 0) |
1921 SkDebugf("%s0};\n", pBuffer); | 1925 SkDebugf("%s0};\n", pBuffer); |
1922 | 1926 |
1923 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1927 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1924 } | 1928 } |
1925 | 1929 |
1926 #endif | 1930 #endif |
OLD | NEW |