aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/FileReaderApp/FileReaderWindow.mm
blob: ed4585e1403f301e263ad440767e9ad75f09f195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#import "FileReaderWindow.h"
#import "SkGradientShader.h"

bool gNeverSetToTrueJustNeedToFoolLinker;
static void init_effects() {
  if (gNeverSetToTrueJustNeedToFoolLinker) {
    SkPoint p = SkPoint::Make(0,0);
    SkPoint q = SkPoint::Make(100,100);
    SkPoint pts[] = {p, q};
    SkColor colors[] = { SK_ColorRED, SK_ColorGREEN };
    SkScalar pos[] = { 0, 1.0};
    SkGradientShader::CreateLinear(pts, colors, pos, 2,
                                   SkShader::kMirror_TileMode);
  }
}

@implementation FileReaderWindow
-(void) installSkViews {
    init_effects();
    fReaderView = new ReaderView;
    fReaderView->setVisibleP(true);
    fReaderView->setSize([self frame].size.width, [self frame].size.height);
    [fView addSkView:fReaderView];
    [fView setNeedsDisplay:YES];
    fReaderView->unref();
    //TODO - Temporary fix. Inval doesn't Seem to be working.
    [NSTimer scheduledTimerWithTimeInterval:0.01 target:self
                                   selector:@selector(redraw) userInfo:nil
                                    repeats:YES];
}

- (void)redraw {
    [fView setNeedsDisplay:YES];
}
@end