Home | History | Annotate | Download | only in FileReaderApp
      1 #import "FileReaderWindow.h"
      2 #import "SkGradientShader.h"
      3 
      4 bool gNeverSetToTrueJustNeedToFoolLinker;
      5 static void init_effects() {
      6   if (gNeverSetToTrueJustNeedToFoolLinker) {
      7     SkPoint p = SkPoint::Make(0,0);
      8     SkPoint q = SkPoint::Make(100,100);
      9     SkPoint pts[] = {p, q};
     10     SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
     11     SkScalar pos[] = { 0, 1.0};
     12     SkGradientShader::CreateLinear(pts, colors, pos, 2, 
     13                                    SkShader::kMirror_TileMode);
     14   }
     15 }
     16 
     17 @implementation FileReaderWindow
     18 -(void) installSkViews {
     19     init_effects();
     20     fReaderView = new ReaderView;
     21     fReaderView->setVisibleP(true);
     22     fReaderView->setSize([self frame].size.width, [self frame].size.height);
     23     [fView addSkView:fReaderView];
     24     [fView setNeedsDisplay:YES];
     25     fReaderView->unref();
     26     //TODO - Temporary fix. Inval doesn't Seem to be working. 
     27     [NSTimer scheduledTimerWithTimeInterval:0.01 target:self 
     28                                    selector:@selector(redraw) userInfo:nil 
     29                                     repeats:YES];
     30 }
     31 
     32 - (void)redraw {
     33     [fView setNeedsDisplay:YES];
     34 }
     35 @end