call notifyPixelsChanged() when the pages are flipped in pageflippixelref
update samples git-svn-id: http://skia.googlecode.com/svn/trunk@192 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
89bb83abb4
commit
44a6312cf6
@ -29,14 +29,6 @@ static const struct {
|
||||
|
||||
static const int gFaceCount = SK_ARRAY_COUNT(gFaces);
|
||||
|
||||
static const char* gStrings[] = {
|
||||
"HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH",
|
||||
"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii",
|
||||
"......................................",
|
||||
"11111111111111111111111111111111111111",
|
||||
"00000000000000000000000000000000000000"
|
||||
};
|
||||
|
||||
class FontScalerTestView : public SkView {
|
||||
SkTypeface* fFaces[gFaceCount];
|
||||
|
||||
@ -110,7 +102,6 @@ protected:
|
||||
|
||||
int index = 0;
|
||||
for (int ps = 9; ps <= 24; ps++) {
|
||||
// text = gStrings[index % SK_ARRAY_COUNT(gStrings)];
|
||||
textLen = strlen(text);
|
||||
paint.setTextSize(SkIntToScalar(ps));
|
||||
canvas->drawText(text, textLen, x, y, paint);
|
||||
|
@ -235,20 +235,11 @@ protected:
|
||||
return;
|
||||
}
|
||||
|
||||
SkScalar scale = SK_Scalar1 * 999/1000;
|
||||
// scale = SK_Scalar1/2;
|
||||
|
||||
canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
|
||||
// canvas->scale(scale, scale);
|
||||
|
||||
SkScalar x = SkIntToScalar(32), y = SkIntToScalar(32);
|
||||
SkPaint paint;
|
||||
|
||||
// x += fDX;
|
||||
// y += fDY;
|
||||
|
||||
// paint.setLooper(new SkBlurDrawLooper(SkIntToScalar(12), 0, 0, 0xDD000000))->unref();
|
||||
|
||||
#if 0
|
||||
for (int i = 0; i < fBitmapCount; i++) {
|
||||
SkPaint p;
|
||||
|
@ -44,7 +44,7 @@ static void* draw_proc(void* context) {
|
||||
SkPaint paint;
|
||||
|
||||
paint.setAntiAlias(true);
|
||||
paint.setColor(reinterpret_cast<SkColor>(ref) | (0xFF << 24));
|
||||
paint.setColor(SK_ColorRED);
|
||||
|
||||
SkRect oval;
|
||||
oval.setEmpty();
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
|
||||
ShaderView()
|
||||
{
|
||||
SkImageDecoder::DecodeFile("/cover.png", &fBitmap);
|
||||
SkImageDecoder::DecodeFile("/skimages/logo.gif", &fBitmap);
|
||||
|
||||
SkPoint pts[2];
|
||||
SkColor colors[2];
|
||||
@ -79,10 +79,8 @@ public:
|
||||
|
||||
protected:
|
||||
// overrides from SkEventSink
|
||||
virtual bool onQuery(SkEvent* evt)
|
||||
{
|
||||
if (SampleCode::TitleQ(*evt))
|
||||
{
|
||||
virtual bool onQuery(SkEvent* evt) {
|
||||
if (SampleCode::TitleQ(*evt)) {
|
||||
SampleCode::TitleR(evt, "Shaders");
|
||||
return true;
|
||||
}
|
||||
@ -101,18 +99,7 @@ protected:
|
||||
|
||||
canvas->drawBitmap(fBitmap, 0, 0);
|
||||
|
||||
{
|
||||
SkIRect src;
|
||||
SkRect dst;
|
||||
|
||||
src.set(20, 50, 120, 70);
|
||||
dst.set(src);
|
||||
dst.offset(SkIntToScalar(300), 0);
|
||||
|
||||
canvas->drawBitmapRect(fBitmap, &src, dst);
|
||||
}
|
||||
|
||||
canvas->translate(SkIntToScalar(80), SkIntToScalar(80));
|
||||
canvas->translate(SkIntToScalar(20), SkIntToScalar(120));
|
||||
|
||||
SkPaint paint;
|
||||
SkRect r;
|
||||
@ -124,7 +111,11 @@ protected:
|
||||
|
||||
canvas->translate(SkIntToScalar(110), 0);
|
||||
|
||||
r.set(0, 0, SkIntToScalar(fBitmap.width()), SkIntToScalar(fBitmap.height()));
|
||||
int w = fBitmap.width();
|
||||
int h = fBitmap.height();
|
||||
w = 120;
|
||||
h = 80;
|
||||
r.set(0, 0, SkIntToScalar(w), SkIntToScalar(h));
|
||||
|
||||
paint.setShader(NULL);
|
||||
canvas->drawRect(r, paint);
|
||||
|
@ -90,13 +90,13 @@ static SkMaskFilter* makemf() { return new Darken(0x30); }
|
||||
|
||||
static void test_typefaceCache()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
SkTypeface* t0 = SkTypeface::CreateFromName("sans-serif",
|
||||
SkTypeface::kNormal);
|
||||
SkTypeface* t1 = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal);
|
||||
SkTypeface* t2 = SkTypeface::CreateFromName("arial", SkTypeface::kNormal);
|
||||
SkTypeface* t3 = SkTypeface::CreateFromName("helvetica", SkTypeface::kItalic);
|
||||
|
||||
#ifdef ANDROID
|
||||
SkASSERT(t0 == t1);
|
||||
SkASSERT(t0 == t2);
|
||||
SkASSERT(t0 == t3);
|
||||
|
@ -20,48 +20,6 @@
|
||||
#include "SkStream.h"
|
||||
#include "SkNinePatch.h"
|
||||
|
||||
void setup_vertexbug(SkPoint verts[], SkPoint texs[], uint16_t index[]);
|
||||
|
||||
static void drawbug(SkCanvas* canvas, SkScalar scale) {
|
||||
SkBitmap bm, bm2;
|
||||
|
||||
SkImageDecoder::DecodeFile("/skimages/btn_default_normal.9.png", &bm);
|
||||
SkPaint paint;
|
||||
|
||||
SkIRect subset;
|
||||
subset.set(1, 1, bm.width() - 1, bm.height() - 1);
|
||||
bm.extractSubset(&bm2, subset);
|
||||
|
||||
#if 0
|
||||
SkPoint verts[16], texs[16];
|
||||
uint16_t index[54];
|
||||
|
||||
SkShader* s = SkShader::CreateBitmapShader(bm2, SkShader::kClamp_TileMode,
|
||||
SkShader::kClamp_TileMode);
|
||||
paint.setShader(s)->unref();
|
||||
|
||||
setup_vertexbug(verts, texs, index);
|
||||
int indexCount = 6; // 54
|
||||
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, 16, verts, texs,
|
||||
NULL, NULL, &index[6], indexCount, paint);
|
||||
|
||||
#if 0
|
||||
paint.setShader(NULL);
|
||||
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, 16, verts, NULL,
|
||||
NULL, NULL, index, indexCount, paint);
|
||||
#endif
|
||||
#else
|
||||
SkRect dst;
|
||||
SkIRect margin;
|
||||
|
||||
dst.set(SkIntToScalar(10), SkIntToScalar(10),
|
||||
SkIntToScalar(100) + scale,
|
||||
SkIntToScalar(40) + scale);
|
||||
margin.set(9, 9, 9, 9);
|
||||
SkNinePatch::DrawNine(canvas, dst, bm2, margin, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
static SkShader* make_shader0(SkIPoint* size) {
|
||||
SkBitmap bm;
|
||||
|
||||
@ -122,16 +80,6 @@ protected:
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
this->drawBG(canvas);
|
||||
|
||||
#if 1
|
||||
canvas->drawColor(SK_ColorWHITE);
|
||||
canvas->translate(SK_Scalar1/2, SkIntToScalar(15) + SK_Scalar1/2);
|
||||
canvas->scale(SkIntToScalar(3)/2, SkIntToScalar(3)/2);
|
||||
drawbug(canvas, fScale);
|
||||
fScale += SK_Scalar1/93;
|
||||
this->inval(NULL);
|
||||
return;
|
||||
#endif
|
||||
|
||||
SkPaint paint;
|
||||
paint.setDither(true);
|
||||
paint.setFilterBitmap(true);
|
||||
|
@ -49,6 +49,7 @@ void SkFlipPixelRef::onUnlockPixels() {
|
||||
void SkFlipPixelRef::swapPages() {
|
||||
fMutex.acquire();
|
||||
SkTSwap<void*>(fPage0, fPage1);
|
||||
this->notifyPixelsChanged();
|
||||
fMutex.release();
|
||||
}
|
||||
|
||||
|
@ -37,14 +37,12 @@
|
||||
0064EE3F0FC72BEE00D71FB0 /* SampleMeasure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0B0FC72BEE00D71FB0 /* SampleMeasure.cpp */; };
|
||||
0064EE410FC72BEE00D71FB0 /* SampleNinePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0D0FC72BEE00D71FB0 /* SampleNinePatch.cpp */; };
|
||||
0064EE420FC72BEE00D71FB0 /* SampleOverflow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0E0FC72BEE00D71FB0 /* SampleOverflow.cpp */; };
|
||||
0064EE440FC72BEE00D71FB0 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE100FC72BEE00D71FB0 /* SamplePatch.cpp */; };
|
||||
0064EE450FC72BEE00D71FB0 /* SamplePath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE110FC72BEE00D71FB0 /* SamplePath.cpp */; };
|
||||
0064EE460FC72BEE00D71FB0 /* SamplePathClip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE120FC72BEE00D71FB0 /* SamplePathClip.cpp */; };
|
||||
0064EE470FC72BEE00D71FB0 /* SamplePathEffects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE130FC72BEE00D71FB0 /* SamplePathEffects.cpp */; };
|
||||
0064EE480FC72BEE00D71FB0 /* SamplePicture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE140FC72BEE00D71FB0 /* SamplePicture.cpp */; };
|
||||
0064EE490FC72BEE00D71FB0 /* SamplePoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE150FC72BEE00D71FB0 /* SamplePoints.cpp */; };
|
||||
0064EE4B0FC72BEE00D71FB0 /* SampleRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE170FC72BEE00D71FB0 /* SampleRegion.cpp */; };
|
||||
0064EE4C0FC72BEE00D71FB0 /* SampleShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE180FC72BEE00D71FB0 /* SampleShaders.cpp */; };
|
||||
0064EE4E0FC72BEE00D71FB0 /* SampleStrokeText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1A0FC72BEE00D71FB0 /* SampleStrokeText.cpp */; };
|
||||
0064EE500FC72BEE00D71FB0 /* SampleText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1C0FC72BEE00D71FB0 /* SampleText.cpp */; };
|
||||
0064EE510FC72BEE00D71FB0 /* SampleTextAlpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1D0FC72BEE00D71FB0 /* SampleTextAlpha.cpp */; };
|
||||
@ -52,7 +50,6 @@
|
||||
0064EE530FC72BEE00D71FB0 /* SampleTextOnPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE1F0FC72BEE00D71FB0 /* SampleTextOnPath.cpp */; };
|
||||
0064EE540FC72BEE00D71FB0 /* SampleTiling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE200FC72BEE00D71FB0 /* SampleTiling.cpp */; };
|
||||
0064EE550FC72BEE00D71FB0 /* SampleTypeface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE210FC72BEE00D71FB0 /* SampleTypeface.cpp */; };
|
||||
0064EE560FC72BEE00D71FB0 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE220FC72BEE00D71FB0 /* SampleVertices.cpp */; };
|
||||
0064EE570FC72BEE00D71FB0 /* SampleXfermodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE230FC72BEE00D71FB0 /* SampleXfermodes.cpp */; };
|
||||
0064EE580FC72BEE00D71FB0 /* vertexdump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE240FC72BEE00D71FB0 /* vertexdump.cpp */; };
|
||||
0064EE960FC7318500D71FB0 /* SkImageRefPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE930FC7318500D71FB0 /* SkImageRefPool.cpp */; };
|
||||
@ -77,7 +74,6 @@
|
||||
006DC7EB0FC7475E00BF5F45 /* libmaccore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 006DC7E10FC7475700BF5F45 /* libmaccore.a */; };
|
||||
006DC7EC0FC7475F00BF5F45 /* libcore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 006DC7E90FC7475900BF5F45 /* libcore.a */; };
|
||||
2762F6040FCCC832002BD8B4 /* SampleShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE190FC72BEE00D71FB0 /* SampleShapes.cpp */; };
|
||||
2762F6350FCCCA00002BD8B4 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0F0FC72BEE00D71FB0 /* SamplePageFlip.cpp */; };
|
||||
2762F6420FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2762F6400FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp */; };
|
||||
2762F6430FCCCA6C002BD8B4 /* SkPageFlipper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2762F6410FCCCA6C002BD8B4 /* SkPageFlipper.cpp */; };
|
||||
2762F6C20FCCCBC0002BD8B4 /* SampleAll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EDF00FC72BEE00D71FB0 /* SampleAll.cpp */; };
|
||||
@ -88,6 +84,10 @@
|
||||
277836410FCF8908006549E4 /* SkGLTextCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2778363B0FCF8908006549E4 /* SkGLTextCache.cpp */; };
|
||||
277836420FCF8908006549E4 /* SkTextureCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2778363C0FCF8908006549E4 /* SkTextureCache.cpp */; };
|
||||
277836500FCF89F9006549E4 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2778364F0FCF89F9006549E4 /* OpenGL.framework */; };
|
||||
27E1AAA70FD0C51B00098FC5 /* SampleVertices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE220FC72BEE00D71FB0 /* SampleVertices.cpp */; };
|
||||
27E1AACB0FD0C87200098FC5 /* SamplePatch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE100FC72BEE00D71FB0 /* SamplePatch.cpp */; };
|
||||
27E1AAE00FD0C9B500098FC5 /* SampleShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE180FC72BEE00D71FB0 /* SampleShaders.cpp */; };
|
||||
27E1AB2B0FD0D06600098FC5 /* SamplePageFlip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0064EE0F0FC72BEE00D71FB0 /* SamplePageFlip.cpp */; };
|
||||
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
@ -579,13 +579,11 @@
|
||||
0064EE3F0FC72BEE00D71FB0 /* SampleMeasure.cpp in Sources */,
|
||||
0064EE410FC72BEE00D71FB0 /* SampleNinePatch.cpp in Sources */,
|
||||
0064EE420FC72BEE00D71FB0 /* SampleOverflow.cpp in Sources */,
|
||||
0064EE440FC72BEE00D71FB0 /* SamplePatch.cpp in Sources */,
|
||||
0064EE450FC72BEE00D71FB0 /* SamplePath.cpp in Sources */,
|
||||
0064EE460FC72BEE00D71FB0 /* SamplePathClip.cpp in Sources */,
|
||||
0064EE470FC72BEE00D71FB0 /* SamplePathEffects.cpp in Sources */,
|
||||
0064EE490FC72BEE00D71FB0 /* SamplePoints.cpp in Sources */,
|
||||
0064EE4B0FC72BEE00D71FB0 /* SampleRegion.cpp in Sources */,
|
||||
0064EE4C0FC72BEE00D71FB0 /* SampleShaders.cpp in Sources */,
|
||||
0064EE4E0FC72BEE00D71FB0 /* SampleStrokeText.cpp in Sources */,
|
||||
0064EE500FC72BEE00D71FB0 /* SampleText.cpp in Sources */,
|
||||
0064EE510FC72BEE00D71FB0 /* SampleTextAlpha.cpp in Sources */,
|
||||
@ -593,7 +591,6 @@
|
||||
0064EE530FC72BEE00D71FB0 /* SampleTextOnPath.cpp in Sources */,
|
||||
0064EE540FC72BEE00D71FB0 /* SampleTiling.cpp in Sources */,
|
||||
0064EE550FC72BEE00D71FB0 /* SampleTypeface.cpp in Sources */,
|
||||
0064EE560FC72BEE00D71FB0 /* SampleVertices.cpp in Sources */,
|
||||
0064EE480FC72BEE00D71FB0 /* SamplePicture.cpp in Sources */,
|
||||
0064EE570FC72BEE00D71FB0 /* SampleXfermodes.cpp in Sources */,
|
||||
0064EE580FC72BEE00D71FB0 /* vertexdump.cpp in Sources */,
|
||||
@ -616,7 +613,6 @@
|
||||
0064EED20FC7336100D71FB0 /* SkWindow.cpp in Sources */,
|
||||
0064EFA60FC7467C00D71FB0 /* skia_sdl_main.cpp in Sources */,
|
||||
2762F6040FCCC832002BD8B4 /* SampleShapes.cpp in Sources */,
|
||||
2762F6350FCCCA00002BD8B4 /* SamplePageFlip.cpp in Sources */,
|
||||
2762F6420FCCCA6C002BD8B4 /* SkFlipPixelRef.cpp in Sources */,
|
||||
2762F6430FCCCA6C002BD8B4 /* SkPageFlipper.cpp in Sources */,
|
||||
2762F6C20FCCCBC0002BD8B4 /* SampleAll.cpp in Sources */,
|
||||
@ -626,6 +622,10 @@
|
||||
277836400FCF8908006549E4 /* SkGLDevice_FBO.cpp in Sources */,
|
||||
277836410FCF8908006549E4 /* SkGLTextCache.cpp in Sources */,
|
||||
277836420FCF8908006549E4 /* SkTextureCache.cpp in Sources */,
|
||||
27E1AAA70FD0C51B00098FC5 /* SampleVertices.cpp in Sources */,
|
||||
27E1AACB0FD0C87200098FC5 /* SamplePatch.cpp in Sources */,
|
||||
27E1AAE00FD0C9B500098FC5 /* SampleShaders.cpp in Sources */,
|
||||
27E1AB2B0FD0D06600098FC5 /* SamplePageFlip.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#define WINDOW_WIDTH 800
|
||||
#define WINDOW_HEIGHT 600
|
||||
#define USE_GL true
|
||||
#define USE_GL false
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
Uint32 initflags = SDL_INIT_VIDEO | SDL_INIT_TIMER;
|
||||
|
Loading…
Reference in New Issue
Block a user